Skip to content

Commit

Permalink
gtp: reload GTPv1 header after pskb_may_pull()
Browse files Browse the repository at this point in the history
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: 459aa66 ("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>
  • Loading branch information
Pablo Neira authored and David S. Miller committed May 10, 2016
1 parent 1dee3f5 commit 93edb8c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/gtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 93edb8c

Please sign in to comment.