Skip to content

Commit e3e86b5

Browse files
committed
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: 2423496 ("ipv6: Prevent overrun when parsing v6 header options") Reported-by: Ben Hutchings <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 9a1c44d commit e3e86b5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/ipv6/ip6_offload.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
116116

117117
if (udpfrag) {
118118
int err = ip6_find_1stfragopt(skb, &prevhdr);
119-
if (err < 0)
119+
if (err < 0) {
120+
kfree_skb_list(segs);
120121
return ERR_PTR(err);
122+
}
121123
fptr = (struct frag_hdr *)((u8 *)ipv6h + err);
122124
fptr->frag_off = htons(offset);
123125
if (skb->next)

0 commit comments

Comments
 (0)