diff options
author | Eric Dumazet <[email protected]> | 2018-01-10 03:45:49 -0800 |
---|---|---|
committer | David S. Miller <[email protected]> | 2018-01-10 16:01:25 -0500 |
commit | 862c03ee1deb7e19e0f9931682e0294ecd1fcaf9 (patch) | |
tree | e720e5abc25b35104208ba568cac3bf03b7d82d6 | |
parent | 8f3d194600a5fe7d5071ea0260c7fa9317f156f6 (diff) |
ipv6: fix possible mem leaks in ipv6_make_skb()
ip6_setup_cork() might return an error, while memory allocations have
been done and must be rolled back.
Fixes: 6422398c2ab0 ("ipv6: introduce ipv6_make_skb")
Signed-off-by: Eric Dumazet <[email protected]>
Cc: Vlad Yasevich <[email protected]>
Reported-by: Mike Maloney <[email protected]>
Acked-by: Mike Maloney <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
-rw-r--r-- | net/ipv6/ip6_output.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index f7dd51c42314..688ba5f7516b 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1735,9 +1735,10 @@ struct sk_buff *ip6_make_skb(struct sock *sk, cork.base.opt = NULL; v6_cork.opt = NULL; err = ip6_setup_cork(sk, &cork, &v6_cork, ipc6, rt, fl6); - if (err) + if (err) { + ip6_cork_release(&cork, &v6_cork); return ERR_PTR(err); - + } if (ipc6->dontfrag < 0) ipc6->dontfrag = inet6_sk(sk)->dontfrag; |