From: Gao feng <gaofeng@cn.fujitsu.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH RESEND] netfilter: bridge: unshare bridge info before change it
Date: Wed, 19 Nov 2014 10:11:25 +0800 [thread overview]
Message-ID: <546BFC4D.7070203@cn.fujitsu.com> (raw)
In-Reply-To: <20141118183419.GA5078@salvia>
On 11/19/2014 02:34 AM, Pablo Neira Ayuso wrote:
> On Mon, Nov 17, 2014 at 01:48:43PM +0800, Gao feng wrote:
>> diff --git a/net/bridge/br_netfilter.c b/net/bridge/br_netfilter.c
>> index 1a4f32c..b4612b9 100644
>> --- a/net/bridge/br_netfilter.c
>> +++ b/net/bridge/br_netfilter.c
>> @@ -653,7 +643,11 @@ static int br_nf_forward_finish(struct sk_buff *skb)
>> in = nf_bridge->physindev;
>> if (nf_bridge->mask & BRNF_PKT_TYPE) {
>> skb->pkt_type = PACKET_OTHERHOST;
>> - nf_bridge->mask ^= BRNF_PKT_TYPE;
>> +
>> + if (!nf_bridge_unset_mask(skb, BRNF_PKT_TYPE)) {
>> + kfree_skb(skb);
>> + return 0;
>> + }
>
> This can now release the packet and, thus, drop it.
>
> However, br_nf_forward_ip() always returns NF_STOLEN.
>
> Could you revisit the error paths and confirm they are correct?
Since br_nf_forward_ip() returns NF_STOLEN, br_nf_forward_finish should make
sure this skb will be released. if unser_mask for this skb is failed, we free
it. if unset successed, the hooks on NF_BR_FORWARD or br_forward_finish will
free this skb.
I check the error paths again, find a missing null check of nf_bridge. I will
post v2 patch.
next prev parent reply other threads:[~2014-11-19 2:11 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-17 5:48 [PATCH RESEND] netfilter: bridge: unshare bridge info before change it Gao feng
2014-11-18 18:34 ` Pablo Neira Ayuso
2014-11-19 2:11 ` Gao feng [this message]
2014-11-19 11:17 ` Pablo Neira Ayuso
2014-11-19 11:49 ` Pablo Neira Ayuso
2014-11-20 1:14 ` Gao feng
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=546BFC4D.7070203@cn.fujitsu.com \
--to=gaofeng@cn.fujitsu.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.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).