GSO: Reload iph after pskb_may_pull
authorArnaldo Carvalho de Melo <acme@kernel.org>
Mon, 28 Nov 2016 15:36:58 +0000 (12:36 -0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 30 Nov 2016 01:45:54 +0000 (20:45 -0500)
As it may get stale and lead to use after free.

Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Alexander Duyck <aduyck@mirantis.com>
Cc: Andrey Konovalov <andreyknvl@google.com>
Fixes: cbc53e08a793 ("GSO: Add GSO type for fixed IPv4 ID")
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/af_inet.c

index 5ddf5cda07f4173b0c110c034390428fe2928097..215143246e4b3e57440aba0fd314d0e96acd22a7 100644 (file)
@@ -1233,7 +1233,7 @@ struct sk_buff *inet_gso_segment(struct sk_buff *skb,
                fixedid = !!(skb_shinfo(skb)->gso_type & SKB_GSO_TCP_FIXEDID);
 
                /* fixed ID is invalid if DF bit is not set */
-               if (fixedid && !(iph->frag_off & htons(IP_DF)))
+               if (fixedid && !(ip_hdr(skb)->frag_off & htons(IP_DF)))
                        goto out;
        }