Skip to content

Commit

Permalink
ipv4: fix a potential use after free in fou.c
Browse files Browse the repository at this point in the history
pskb_may_pull() maybe change skb->data and make uh pointer oboslete,
so reload uh and guehdr

Fixes: 37dd024 ("gue: Receive side for Generic UDP Encapsulation")
Cc: Tom Herbert <therbert@google.com>
Signed-off-by: Li RongQing <roy.qing.li@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Li RongQing authored and David S. Miller committed Oct 18, 2014
1 parent 1245dfc commit d8f00d2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions net/ipv4/fou.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ static int gue_udp_recv(struct sock *sk, struct sk_buff *skb)
if (!pskb_may_pull(skb, len))
goto drop;

uh = udp_hdr(skb);
guehdr = (struct guehdr *)&uh[1];

if (guehdr->version != 0)
goto drop;

Expand Down

0 comments on commit d8f00d2

Please sign in to comment.