mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-28 01:21:58 +00:00
ipv4: fix memory leaks in ip_cmsg_send() callers
Dmitry reported memory leaks of IP options allocated in ip_cmsg_send() when/if this function returns an error. Callers are responsible for the freeing. Many thanks to Dmitry for the report and diagnostic. Reported-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
c2bb7bc5c0
commit
919483096b
4 changed files with 11 additions and 3 deletions
|
@ -547,8 +547,10 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
|
|||
|
||||
if (msg->msg_controllen) {
|
||||
err = ip_cmsg_send(net, msg, &ipc, false);
|
||||
if (err)
|
||||
if (unlikely(err)) {
|
||||
kfree(ipc.opt);
|
||||
goto out;
|
||||
}
|
||||
if (ipc.opt)
|
||||
free = 1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue