Commit 6ab0acaf authored by Eric Dumazet's avatar Eric Dumazet Committed by Kleber Sacilotto de Souza

ipv6: fix possible mem leaks in ipv6_make_skb()

BugLink: http://bugs.launchpad.net/bugs/1745266

[ Upstream commit 862c03ee ]

ip6_setup_cork() might return an error, while memory allocations have
been done and must be rolled back.

Fixes: 6422398c ("ipv6: introduce ipv6_make_skb")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Cc: Vlad Yasevich <vyasevich@gmail.com>
Reported-by: default avatarMike Maloney <maloney@google.com>
Acked-by: default avatarMike Maloney <maloney@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 4535d75c
......@@ -1792,8 +1792,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, 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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment