From: Changli Gao <xiaosuo@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: "Jamal Hadi Salim" <hadi@cyberus.ca>,
"Rodrigo Partearroyo González" <rpartearroyo@albentia.com>,
"Herbert Xu" <herbert@gondor.apana.org.au>,
"Eric Dumazet" <eric.dumazet@gmail.com>,
"Iratxo Pichel Ortiz" <ipichel@albentia.com>,
"Noelia Morón" <nmoron@albentia.com>,
netdev@vger.kernel.org, "Changli Gao" <xiaosuo@gmail.com>
Subject: [PATCH] act_nat: not all of the ICMP packets need an IP header payload
Date: Sat, 10 Jul 2010 09:33:25 +0800 [thread overview]
Message-ID: <1278725605-28598-1-git-send-email-xiaosuo@gmail.com> (raw)
act_nat: not all of the ICMP packets need an IP header payload
not all of the ICMP packets need an IP header payload, so we check the length
of the skbs only when the packets should have an IP header payload.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
net/sched/act_nat.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 0be49a4..24e614c 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -205,7 +205,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
{
struct icmphdr *icmph;
- if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph)))
+ if (!pskb_may_pull(skb, ihl + sizeof(*icmph)))
goto drop;
icmph = (void *)(skb_network_header(skb) + ihl);
@@ -215,6 +215,9 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
(icmph->type != ICMP_PARAMETERPROB))
break;
+ if (!pskb_may_pull(skb, ihl + sizeof(*icmph) + sizeof(*iph)))
+ goto drop;
+
iph = (void *)(icmph + 1);
if (egress)
addr = iph->daddr;
next reply other threads:[~2010-07-10 1:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-10 1:33 Changli Gao [this message]
2010-07-10 6:22 ` [PATCH] act_nat: not all of the ICMP packets need an IP header payload Eric Dumazet
2010-07-10 14:08 ` Changli Gao
2010-07-13 3:02 ` David Miller
2010-07-10 6:26 ` Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1278725605-28598-1-git-send-email-xiaosuo@gmail.com \
--to=xiaosuo@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=hadi@cyberus.ca \
--cc=herbert@gondor.apana.org.au \
--cc=ipichel@albentia.com \
--cc=netdev@vger.kernel.org \
--cc=nmoron@albentia.com \
--cc=rpartearroyo@albentia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).