mirror of
https://github.com/torvalds/linux.git
synced 2024-11-26 14:12:06 +00:00
ipv6: xfrm: Handle errors reported by xfrm6_find_1stfragopt()
xfrm6_find_1stfragopt() may now return an error code and we must
not treat it as a length.
Fixes: 2423496af3
("ipv6: Prevent overrun when parsing v6 header options")
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Acked-by: Craig Gallek <kraig@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
13fb6c2c7f
commit
6e80ac5cc9
@ -47,6 +47,8 @@ static int xfrm6_ro_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||
iph = ipv6_hdr(skb);
|
||||
|
||||
hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
|
||||
if (hdr_len < 0)
|
||||
return hdr_len;
|
||||
skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data);
|
||||
skb_set_network_header(skb, -x->props.header_len);
|
||||
skb->transport_header = skb->network_header + hdr_len;
|
||||
|
@ -30,6 +30,8 @@ static int xfrm6_transport_output(struct xfrm_state *x, struct sk_buff *skb)
|
||||
skb_set_inner_transport_header(skb, skb_transport_offset(skb));
|
||||
|
||||
hdr_len = x->type->hdr_offset(x, skb, &prevhdr);
|
||||
if (hdr_len < 0)
|
||||
return hdr_len;
|
||||
skb_set_mac_header(skb, (prevhdr - x->props.header_len) - skb->data);
|
||||
skb_set_network_header(skb, -x->props.header_len);
|
||||
skb->transport_header = skb->network_header + hdr_len;
|
||||
|
Loading…
Reference in New Issue
Block a user