Commit 55fb722b authored by David S. Miller's avatar David S. Miller Committed by Ben Hutchings

ipv6: Fix leak in ipv6_gso_segment().

commit e3e86b51 upstream.

If ip6_find_1stfragopt() fails and we return an error we have to free
up 'segs' because nobody else is going to.

Fixes: 2423496a ("ipv6: Prevent overrun when parsing v6 header options")
Reported-by: default avatarBen Hutchings <ben@decadent.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
[bwh: Backported to 3.2: adjust filename, context]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent c5923c01
......@@ -824,8 +824,10 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, u32 features)
sizeof(*ipv6h));
if (proto == IPPROTO_UDP) {
int err = ip6_find_1stfragopt(skb, &prevhdr);
if (err < 0)
if (err < 0) {
kfree_skb_list(segs);
return ERR_PTR(err);
}
fptr = (struct frag_hdr *)(skb_network_header(skb) +
err);
fptr->frag_off = htons(offset);
......
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