netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ipv6: fix possible mem leaks in ipv6_make_skb()
@ 2018-01-10 11:45 Eric Dumazet
  2018-01-10 14:00 ` Mike Maloney
  2018-01-10 21:02 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2018-01-10 11:45 UTC (permalink / raw)
  To: Vladislav Yasevich, David Miller; +Cc: netdev, Mike Maloney

From: Eric Dumazet <edumazet@google.com>

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>
---
 net/ipv6/ip6_output.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index f7dd51c4231415fd1321fd431194d896ea2d1689..688ba5f7516b37c87b879036dce781bdcfa01739 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;
 

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ipv6: fix possible mem leaks in ipv6_make_skb()
  2018-01-10 11:45 [PATCH net] ipv6: fix possible mem leaks in ipv6_make_skb() Eric Dumazet
@ 2018-01-10 14:00 ` Mike Maloney
  2018-01-10 21:02 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Mike Maloney @ 2018-01-10 14:00 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: Vladislav Yasevich, David Miller, netdev, Mike Maloney

Acked-by:  Mike Maloney <maloney@google.com>

Thanks Eric!

On Wed, Jan 10, 2018 at 6:45 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> 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>
> ---
>  net/ipv6/ip6_output.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
> index f7dd51c4231415fd1321fd431194d896ea2d1689..688ba5f7516b37c87b879036dce781bdcfa01739 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;
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] ipv6: fix possible mem leaks in ipv6_make_skb()
  2018-01-10 11:45 [PATCH net] ipv6: fix possible mem leaks in ipv6_make_skb() Eric Dumazet
  2018-01-10 14:00 ` Mike Maloney
@ 2018-01-10 21:02 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-01-10 21:02 UTC (permalink / raw)
  To: eric.dumazet; +Cc: vyasevic, netdev, maloney

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 10 Jan 2018 03:45:49 -0800

> From: Eric Dumazet <edumazet@google.com>
> 
> 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>

Applied and queeud up for -stable, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-01-10 21:02 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-01-10 11:45 [PATCH net] ipv6: fix possible mem leaks in ipv6_make_skb() Eric Dumazet
2018-01-10 14:00 ` Mike Maloney
2018-01-10 21:02 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).