diff options
author | David S. Miller <davem@davemloft.net> | 2017-06-04 21:41:10 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-06-04 21:41:10 -0400 |
commit | e3e86b5119f81e5e2499bea7ea1ebe8ac6aab789 (patch) | |
tree | fa83f365a918287b03ba5bcc48dd0878cb14aa96 | |
parent | 9a1c44d989bff4c992b8b9a112d9fda275ea5515 (diff) | |
download | linux-e3e86b5119f81e5e2499bea7ea1ebe8ac6aab789.tar.bz2 |
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: 2423496af35d ("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>
-rw-r--r-- | net/ipv6/ip6_offload.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c index 280268f1dd7b..cdb3728faca7 100644 --- a/net/ipv6/ip6_offload.c +++ b/net/ipv6/ip6_offload.c @@ -116,8 +116,10 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb, if (udpfrag) { 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 *)((u8 *)ipv6h + err); fptr->frag_off = htons(offset); if (skb->next) |