From: Stephen Hemminger <stephen@networkplumber.org>
To: <lichunhe@huawei.com>
Cc: <vyasevic@redhat.com>, <xiyou.wangcong@gmail.com>,
<makita.toshiaki@lab.ntt.co.jp>, <mst@redhat.com>,
<ebiederm@xmission.com>, <f.fainelli@gmail.com>,
<linux-kernel@vger.kernel.org>, <wuyunfei@huawei.com>,
<qianhuibin@huawei.com>
Subject: Re: [PATCH net/next] bridge:Add rcu read lock when delete br port
Date: Mon, 4 Aug 2014 09:29:04 -0700 [thread overview]
Message-ID: <20140804092904.16654a4c@haswell.linuxnetplumber.net> (raw)
In-Reply-To: <1407123476-9720-1-git-send-email-lichunhe@huawei.com>
On Mon, 4 Aug 2014 11:37:56 +0800
<lichunhe@huawei.com> wrote:
> From: Chunhe Li <lichunhe@huawei.com>
>
> In the br_hanle_frame function has a bug, when the bridge receive packets
> which go througth the br_handle_frame, get the net_bridge_port pointer "p",
> but don't check NULL pointer to use it. If somebody delete the bridge port
> at the same time, will call a NULL pointer, trigger kernel panic. I see the
> del_nbp comments, call del_nbp should via RCU, but the caller don't do this.
>
> following steps will make bug happened
> 1.start vm and add the vm interface to a bridge br0,for example,
> brctl addbr br0 tap0
>
> 2.configuer vm interface and br0 same ip subnet, vm ping br0.
>
> 3.add and delete the vm interface port for endless loop.
>
> Signed-off-by: Chunhe Li <lichunhe@huawei.com>
This is safe because:
1. br_dev_delete is called with RTNL mutex therefore it is safe with other add/delete
RCU does not block anything
2. br_handle_frame is called with RCU lock (in frame rx)
3. port is not freed until after grace period
next prev parent reply other threads:[~2014-08-04 16:29 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-04 3:37 lichunhe
2014-08-04 12:40 ` Michael S. Tsirkin
2014-08-05 0:43 ` Lichunhe
2014-08-05 10:07 ` Michael S. Tsirkin
2014-08-04 16:29 ` Stephen Hemminger [this message]
2014-08-04 16:48 ` Stephen Hemminger
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=20140804092904.16654a4c@haswell.linuxnetplumber.net \
--to=stephen@networkplumber.org \
--cc=ebiederm@xmission.com \
--cc=f.fainelli@gmail.com \
--cc=lichunhe@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=makita.toshiaki@lab.ntt.co.jp \
--cc=mst@redhat.com \
--cc=qianhuibin@huawei.com \
--cc=vyasevic@redhat.com \
--cc=wuyunfei@huawei.com \
--cc=xiyou.wangcong@gmail.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
Powered by JetHome