ipv6: fix possible mem leaks in ipv6_make_skb()
Subsystems (3)
PATCH 1/1 ipv6: fix possible mem leaks in ipv6_make_skb()
From: Eric Dumazet <[email protected]>
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]>
---
net/ipv6/ip6_output.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
net/ipv6/ip6_output.c +3 -2
@@ -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;
Acked-by Mike Maloney <[email protected]>
Thanks Eric!
Quoted 30 lines · Eric Dumazet
From: Eric Dumazet <[email protected]>
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]>--- net/ipv6/ip6_output.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)net/ipv6/ip6_output.c +3
-2@@ -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;
David Miller
maintainerFrom: Eric Dumazet <[email protected]>
Date: Wed, 10 Jan 2018 03:45:49 -0800
Quoted 9 lines
From: Eric Dumazet <[email protected]>
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]>
Applied and queeud up for -stable, thanks.