ipv6: Fix leak in ipv6_gso_segment().
If ip6_find_1stfragopt() fails and we return an error we have to free
up 'segs' because nobody else is going to.
Fixes: 2423496af3
("ipv6: Prevent overrun when parsing v6 header options")
Reported-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
9a1c44d989
commit
e3e86b5119
|
@ -116,8 +116,10 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
|
||||||
|
|
||||||
if (udpfrag) {
|
if (udpfrag) {
|
||||||
int err = ip6_find_1stfragopt(skb, &prevhdr);
|
int err = ip6_find_1stfragopt(skb, &prevhdr);
|
||||||
if (err < 0)
|
if (err < 0) {
|
||||||
|
kfree_skb_list(segs);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
|
}
|
||||||
fptr = (struct frag_hdr *)((u8 *)ipv6h + err);
|
fptr = (struct frag_hdr *)((u8 *)ipv6h + err);
|
||||||
fptr->frag_off = htons(offset);
|
fptr->frag_off = htons(offset);
|
||||||
if (skb->next)
|
if (skb->next)
|
||||||
|
|
Loading…
Reference in New Issue