Skip to contentSkip to conversation

ipv4: fix a potential use after free in fou.c

PATCH Applied [email protected] 2 participants 2 messages Oct 17, 2014 – Oct 18, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipv4: fix a potential use after free in fou.c

From: Li RongQing <[email protected]>

pskb_may_pull() maybe change skb->data and make uh pointer oboslete, so reload uh and guehdr

Fixes 37dd0247 ("gue: Receive side for Generic UDP Encapsulation")
Cc Tom Herbert <[email protected]>
---
 net/ipv4/fou.c |    3 +++
 1 file changed, 3 insertions(+)
net/ipv4/fou.c +3 -0
index efa70ad..32e7892 100644
@@ -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;
 
Signature · 1 line
1.7.10.4