From: Stephen Hemminger <shemminger@vyatta.com>
To: Bart De Schuymer <bdschuym@pandora.be>
Cc: Patrick McHardy <kaber@trash.net>,
Eric Dumazet <eric.dumazet@gmail.com>,
netdev@vger.kernel.org
Subject: Re: [BUG] crashes with kvm/nat networking and net-next
Date: Wed, 12 May 2010 15:15:40 -0700 [thread overview]
Message-ID: <20100512151540.6f09a1b8@nehalam> (raw)
In-Reply-To: <4BEAB54A.2070203@pandora.be>
On Wed, 12 May 2010 16:03:54 +0200
Bart De Schuymer <bdschuym@pandora.be> wrote:
> Patrick McHardy wrote:
> > Eric Dumazet wrote:
> >> Le mardi 11 mai 2010 à 20:25 -0700, Stephen Hemminger a écrit :
> >>> This is a regression that is showing up now in net-next, not sure what
> >>> changed recently in bridge netfilter that could be causing it?
> >>>
> >>> [ 4593.956206] BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
> >>> [ 4593.956219] IP: [<ffffffffa03357a4>] br_nf_forward_finish+0x154/0x170 [bridge]
> >> Not sure, but br_nf_forward_ip() has following check :
> >>
> >> if (!skb->nf_bridge)
> >> return NF_ACCEPT;
> >>
> >> while br_nf_forward_arp() missed this check ...
> >>
> >> So we can dereference null pointer later
> >
> > That looks correct to me, offset 0x18 would be nf_bridge_info->mask.
> > Bart, please review, thanks.
> >
> >> diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
> >> index 93f80fe..cd2e5f5 100644
> >> --- a/net/bridge/br_netfilter.c
> >> +++ b/net/bridge/br_netfilter.c
> >> @@ -723,6 +723,9 @@ static unsigned int br_nf_forward_arp(unsigned int hook, struct sk_buff *skb,
> >> return NF_ACCEPT;
> >> #endif
> >>
> >> + if (!skb->nf_bridge)
> >> + return NF_ACCEPT;
> >> +
> >> if (skb->protocol != htons(ETH_P_ARP)) {
> >> if (!IS_VLAN_ARP(skb))
> >> return NF_ACCEPT;
>
> That won't fix it since nf_bridge isn't used in the ARP case. The
> correct fix is below. Does anyone know why the null pointer
> dereference (skb->nf_bridge->mask & BRNF_8021Q) in
> nf_bridge_update_protocol() didn't cause my uml kernel to crash??
>
> cheers,
> Bart
>
>
> Don't call nf_bridge_update_protocol() for ARP traffic as
> skb->nf_bridge isn't used in the ARP case.
>
>
> Signed-off-by: Bart De Schuymer <bdschuym@pandora.be>
> Reported-by: Stephen Hemminger <shemminger@vyatta.com>
>
> diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
> index 93f80fe..4442099 100644
> --- a/net/bridge/br_netfilter.c
> +++ b/net/bridge/br_netfilter.c
> @@ -643,10 +643,10 @@ static int br_nf_forward_finish(struct sk_buff *skb)
> skb->pkt_type = PACKET_OTHERHOST;
> nf_bridge->mask ^= BRNF_PKT_TYPE;
> }
> + nf_bridge_update_protocol(skb);
> } else {
> in = *((struct net_device **)(skb->cb));
> }
> - nf_bridge_update_protocol(skb);
> nf_bridge_push_encap_header(skb);
>
> NF_HOOK_THRESH(NFPROTO_BRIDGE, NF_BR_FORWARD, skb, in,
>
This has worked all day for me without problem.
--
next prev parent reply other threads:[~2010-05-12 22:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-12 3:25 [BUG] crashes with kvm/nat networking and net-next Stephen Hemminger
2010-05-12 7:32 ` Eric Dumazet
2010-05-12 11:18 ` Patrick McHardy
2010-05-12 14:03 ` Bart De Schuymer
2010-05-12 22:15 ` Stephen Hemminger [this message]
2010-05-13 12:58 ` 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=20100512151540.6f09a1b8@nehalam \
--to=shemminger@vyatta.com \
--cc=bdschuym@pandora.be \
--cc=eric.dumazet@gmail.com \
--cc=kaber@trash.net \
--cc=netdev@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).