act_nat: fix wild pointer
authorChangli Gao <xiaosuo@gmail.com>
Thu, 29 Jul 2010 13:41:46 +0000 (13:41 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Aug 2010 05:04:54 +0000 (22:04 -0700)
pskb_may_pull() may change skb pointers, so adjust icmph after pskb_may_pull().

Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sched/act_nat.c

index 724553e8ed7bc9d8ecd668c71ab9373936a3d2d3..ea008f57fc830d4d667753267f02487d3943354b 100644 (file)
@@ -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;