Skip to contentSkip to conversation

act_nat: fix wild pointer

PATCH Applied Changli Gao 3 participants 3 messages Jul 30, 2010 – Aug 1, 2010

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

PATCH 1/1 act_nat: fix wild pointer

pskb_may_pull() may change skb pointers, so adjust icmph after pskb_may_pull().

----

 net/sched/act_nat.c |    1 +
 1 file changed, 1 insertion(+)
net/sched/act_nat.c +1 -0
index 24e614c..b6d7c6f 100644
@@ -218,6 +218,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
 		if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph)))
 			goto drop;
 
+		icmph = (void *)(skb_network_header(skb) + ihl);
 		iph = (void *)(icmph + 1);
 		if (egress)
 			addr = iph->daddr;