gtp: reload GTPv1 header after pskb_may_pull()
authorPablo Neira <pablo@netfilter.org>
Tue, 10 May 2016 19:33:38 +0000 (21:33 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 10 May 2016 19:56:23 +0000 (15:56 -0400)
The GTPv1 header flags indicate the presence of optional extensions
after this header. Refresh the pointer to the GTPv1 header as skb->head
might have be reallocated via pskb_may_pull().

Fixes: 459aa660eb1d ("gtp: add initial driver for datapath of GPRS Tunneling Protocol (GTP-U)")
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/gtp.c

index 8ce1104e4fdbea7fb4053970bd2451ad275ef18d..f7caf1e35d83d8be14a8e6d1da72fae358f094aa 100644 (file)
@@ -253,6 +253,8 @@ static int gtp1u_udp_encap_recv(struct gtp_dev *gtp, struct sk_buff *skb,
        if (!pskb_may_pull(skb, hdrlen))
                return -1;
 
+       gtp1 = (struct gtp1_header *)(skb->data + sizeof(struct udphdr));
+
        rcu_read_lock();
        pctx = gtp1_pdp_find(gtp, ntohl(gtp1->tid));
        if (!pctx) {