From: Eric Dumazet <eric.dumazet@gmail.com>
To: Lin Ming <mlin@ss.pku.edu.cn>
Cc: Massimo Cetra <ctrix+debianbugs@navynet.it>,
netdev@vger.kernel.org, Stephen Hemminger <shemminger@vyatta.com>,
"David S. Miller" <davem@davemloft.net>,
Julian Anastasov <ja@ssi.bg>
Subject: Re: [RFC PATCH] bridge: netfilter: fix skb->nf_bridge NULL panic in br_nf_forward_finish
Date: Fri, 06 Jul 2012 17:06:46 +0200 [thread overview]
Message-ID: <1341587206.3265.696.camel@edumazet-glaptop> (raw)
In-Reply-To: <1341584394.4789.34.camel@chief-river-32>
On Fri, 2012-07-06 at 22:19 +0800, Lin Ming wrote:
> I can reproduce similiar panic with 3.5-rc5 kernel as Massimo reported at:
> http://marc.info/?l=linux-netdev&m=134089242113979&w=2
>
> The steps to reproduce as follow,
>
> 1. On Host1, setup brige br0(192.168.1.106)
> 2. Boot a kvm guest(192.168.1.105) on Host1 and start httpd
> 3. Start IPVS service on Host1
> ipvsadm -A -t 192.168.1.106:80 -s rr
> ipvsadm -a -t 192.168.1.106:80 -r 192.168.1.105:80 -m
> 4. Run apache benchmark on Host2(192.168.1.101)
> ab -n 1000 http://192.168.1.106/
>
> The panic happened in br_nf_forward_finish because skb->nf_bridge is NULL.
> skb->nf_bridge is set to NULL in ip_vs_reply4 hook.
>
> br_nf_forward_ip():
> NF_HOOK(pf, NF_INET_FORWARD, skb, brnf_get_logical_dev(skb, in), parent,
> br_nf_forward_finish);
>
> This calls IPVS hook ip_vs_reply4.
>
> ip_vs_reply4
> ip_vs_out
> handle_response
> ip_vs_notrack
> nf_reset()
> {
> skb->nf_bridge = NULL;
> }
>
> This patch added skb->nf_bridge check in br_nf_forward_finish and the panic gone.
> But I am really not sure if this is the right fix.
> Please help to review.
>
> The panic log attached.
...
> Signed-off-by: Lin Ming <mlin@ss.pku.edu.cn>
> ---
> net/bridge/br_netfilter.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
> index e41456b..10da415 100644
> --- a/net/bridge/br_netfilter.c
> +++ b/net/bridge/br_netfilter.c
> @@ -719,7 +719,7 @@ static int br_nf_forward_finish(struct sk_buff *skb)
> struct nf_bridge_info *nf_bridge = skb->nf_bridge;
> struct net_device *in;
>
> - if (!IS_ARP(skb) && !IS_VLAN_ARP(skb)) {
> + if (!IS_ARP(skb) && !IS_VLAN_ARP(skb) && nf_bridge) {
> in = nf_bridge->physindev;
> if (nf_bridge->mask & BRNF_PKT_TYPE) {
> skb->pkt_type = PACKET_OTHERHOST;
So after your patch we have the code in the else clause :
} else {
in = *((struct net_device **)(skb->cb));
}
But do we really have a "struct net_device" pointer stored in skb->cb[]
at this stage ?
AFAIK this is set only for ARP_FORWARD (br_nf_forward_arp() line 838 :
*d = (struct net_device *)in;),
not in br_nf_forward_ip()
If we have garbage instead, we can have other bugs later...
next prev parent reply other threads:[~2012-07-06 15:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-06 14:19 [RFC PATCH] bridge: netfilter: fix skb->nf_bridge NULL panic in br_nf_forward_finish Lin Ming
2012-07-06 15:06 ` Eric Dumazet [this message]
2012-07-06 15:37 ` Lin Ming
2012-07-06 20:34 ` Julian Anastasov
2012-07-09 9:26 ` Massimo Cetra
2012-07-09 12:00 ` Lin Ming
2012-07-10 6:58 ` Massimo Cetra
2012-07-10 8:34 ` Lin Ming
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=1341587206.3265.696.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=ctrix+debianbugs@navynet.it \
--cc=davem@davemloft.net \
--cc=ja@ssi.bg \
--cc=mlin@ss.pku.edu.cn \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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