]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
esp: Fix GRO when the headers not fully in the linear part of the skb.
authorSteffen Klassert <steffen.klassert@secunet.com>
Fri, 5 Jan 2018 07:35:47 +0000 (08:35 +0100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 9 Jan 2018 12:01:58 +0000 (13:01 +0100)
The GRO layer does not necessarily pull the complete headers
into the linear part of the skb, a part may remain on the
first page fragment. This can lead to a crash if we try to
pull the headers, so make sure we have them on the linear
part before pulling.

Fixes: 7785bba299a8 ("esp: Add a software GRO codepath")
Reported-by: syzbot+82bbd65569c49c6c0c4d@syzkaller.appspotmail.com
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/ipv4/esp4_offload.c
net/ipv6/esp6_offload.c

index f8b918c766b0af1e572ed895dcf2435af92016a9..b1338e576d00389db8b6ce2383550e9aa22a4399 100644 (file)
@@ -38,7 +38,8 @@ static struct sk_buff **esp4_gro_receive(struct sk_buff **head,
        __be32 spi;
        int err;
 
-       skb_pull(skb, offset);
+       if (!pskb_pull(skb, offset))
+               return NULL;
 
        if ((err = xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq)) != 0)
                goto out;
index 333a478aa1610441ce08e3ac82e92d3b48e3222d..dd9627490c7ca22bda9fe3cca13b72c60f6865de 100644 (file)
@@ -60,7 +60,8 @@ static struct sk_buff **esp6_gro_receive(struct sk_buff **head,
        int nhoff;
        int err;
 
-       skb_pull(skb, offset);
+       if (!pskb_pull(skb, offset))
+               return NULL;
 
        if ((err = xfrm_parse_spi(skb, IPPROTO_ESP, &spi, &seq)) != 0)
                goto out;