From: Patrick McHardy <kaber@trash.net>
To: Julian Anastasov <ja@ssi.bg>
Cc: netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: nf_nat: fix crash in nf_nat_csum
Date: Tue, 07 Jun 2011 15:07:48 +0200 [thread overview]
Message-ID: <4DEE22A4.8060202@trash.net> (raw)
In-Reply-To: <alpine.LFD.2.00.1105292335220.1429@ja.ssi.bg>
On 29.05.2011 22:42, Julian Anastasov wrote:
>
> Fix crash in nf_nat_csum when mangling packets
> in OUTPUT hook where skb->dev is not defined, it is set
> later before POSTROUTING. Problem happens for CHECKSUM_NONE.
> We can check device from rt but using CHECKSUM_PARTIAL
> should be safe (skb_checksum_help).
We don't call helpers in LOCAL_OUT, how can this happen?
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
> ---
>
> diff -urp v2.6.39/linux/net/ipv4/netfilter/nf_nat_helper.c linux/net/ipv4/netfilter/nf_nat_helper.c
> --- v2.6.39/linux/net/ipv4/netfilter/nf_nat_helper.c 2011-01-06 00:01:22.000000000 +0200
> +++ linux/net/ipv4/netfilter/nf_nat_helper.c 2011-05-29 23:14:40.166245897 +0300
> @@ -160,7 +160,7 @@ static void nf_nat_csum(struct sk_buff *
>
> if (skb->ip_summed != CHECKSUM_PARTIAL) {
> if (!(rt->rt_flags & RTCF_LOCAL) &&
> - skb->dev->features & NETIF_F_V4_CSUM) {
> + (!skb->dev || skb->dev->features & NETIF_F_V4_CSUM)) {
> skb->ip_summed = CHECKSUM_PARTIAL;
> skb->csum_start = skb_headroom(skb) +
> skb_network_offset(skb) +
>
next prev parent reply other threads:[~2011-06-07 13:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-29 20:42 [PATCH] netfilter: nf_nat: fix crash in nf_nat_csum Julian Anastasov
2011-06-07 13:07 ` Patrick McHardy [this message]
2011-06-07 20:02 ` Julian Anastasov
2011-06-07 23:01 ` Patrick McHardy
2011-06-08 9:36 ` Patrick McHardy
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=4DEE22A4.8060202@trash.net \
--to=kaber@trash.net \
--cc=ja@ssi.bg \
--cc=netfilter-devel@vger.kernel.org \
/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).