Commit 4c20da44 authored by David S. Miller's avatar David S. Miller Committed by Linus Torvalds

[IPV4]: Do not leak IP options.

If the user makes ip_cmsg_send call ip_options_get
multiple times, we leak kmalloced IP options data.

Noticed by Georgi Guninski.
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cbb7025b
...@@ -515,6 +515,8 @@ int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen, in ...@@ -515,6 +515,8 @@ int ip_options_get(struct ip_options **optp, unsigned char *data, int optlen, in
kfree(opt); kfree(opt);
return -EINVAL; return -EINVAL;
} }
if (*optp)
kfree(*optp);
*optp = opt; *optp = opt;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment