diff options
author | Eric Dumazet <edumazet@google.com> | 2018-01-10 03:45:49 -0800 |
---|---|---|
committer | Todd Kjos <tkjos@google.com> | 2018-05-31 15:31:16 -0700 |
commit | 9a8bf8ca0860c97a63c195f64d08d065ad50bf7e (patch) | |
tree | 3ff01b7d90dbe48227c63a2fc2dfa4bece769afe | |
parent | 5b215488203590e64d8eaad7a56661b0ecb5a2c7 (diff) | |
download | mediatek-9a8bf8ca0860c97a63c195f64d08d065ad50bf7e.tar.gz |
ipv6: fix possible mem leaks in ipv6_make_skb()
[ Upstream commit 862c03ee1deb7e19e0f9931682e0294ecd1fcaf9 ]
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 <edumazet@google.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Reported-by: Mike Maloney <maloney@google.com>
Acked-by: Mike Maloney <maloney@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | net/ipv6/ip6_output.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c index d0eed64a313b..1f653f4d6e06 100644 --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c @@ -1780,8 +1780,10 @@ struct sk_buff *ip6_make_skb(struct sock *sk, cork.base.dst = NULL; v6_cork.opt = NULL; err = ip6_setup_cork(sk, &cork, &v6_cork, hlimit, tclass, opt, rt, fl6); - if (err) + if (err) { + ip6_cork_release(&cork, &v6_cork); return ERR_PTR(err); + } if (dontfrag < 0) dontfrag = inet6_sk(sk)->dontfrag; |