Netdev List
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Hong Zhiguo <honkiko@gmail.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, vyasevic@redhat.com,
	Hong Zhiguo <zhiguohong@tencent.com>
Subject: Re: [PATCH net-next 2/2] bridge: fix NULL pointer deref of br_port_get_rcu
Date: Sat, 14 Sep 2013 11:47:59 -0700	[thread overview]
Message-ID: <1379184479.24408.46.camel@edumazet-glaptop> (raw)
In-Reply-To: <1379169748-767-3-git-send-email-zhiguohong@tencent.com>

On Sat, 2013-09-14 at 22:42 +0800, Hong Zhiguo wrote:
> From: Hong Zhiguo <zhiguohong@tencent.com>
> 
> The NULL deref happens when br_handle_frame is called between these
> 2 lines of del_nbp:
> 	dev->priv_flags &= ~IFF_BRIDGE_PORT;
> 	/* --> br_handle_frame is called at this time */
> 	netdev_rx_handler_unregister(dev);
> 
> In br_handle_frame the return of br_port_get_rcu(dev) is dereferenced
> without check but br_port_get_rcu(dev) returns NULL if:
> 	!(dev->priv_flags & IFF_BRIDGE_PORT)
> 
> Eric Dumazet pointed out the testing of IFF_BRIDGE_PORT is not necessary
> here since we're in rcu_read_lock and we have synchronize_net() in
> netdev_rx_handler_unregister. So remove the testing of IFF_BRIDGE_PORT
> and by the previous patch, make sure br_port_get_rcu is called in
> bridging code.
> 
> Signed-off-by: Hong Zhiguo <zhiguohong@tencent.com>
> ---
>  net/bridge/br_private.h | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)

Acked-by: Eric Dumazet <edumazet@google.com>

Again this is suitable for net tree.

Thanks !

  reply	other threads:[~2013-09-14 18:48 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-14 14:42 [PATCH net-next 0/2] bridge: fix NULL pointer deref of br_port_get_rcu Hong Zhiguo
2013-09-14 14:42 ` [PATCH net-next 1/2] bridge: use br_port_get_rtnl within rtnl lock Hong Zhiguo
2013-09-14 18:46   ` Eric Dumazet
2013-09-14 14:42 ` [PATCH net-next 2/2] bridge: fix NULL pointer deref of br_port_get_rcu Hong Zhiguo
2013-09-14 18:47   ` Eric Dumazet [this message]
2013-09-16 17:58   ` Vlad Yasevich
2013-09-16 18:32     ` Stephen Hemminger
2013-09-16 18:37       ` Vlad Yasevich
2013-09-16 18:44         ` Stephen Hemminger
2013-09-16  4:55 ` [PATCH net-next 0/2] " David Miller

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=1379184479.24408.46.camel@edumazet-glaptop \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=honkiko@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=vyasevic@redhat.com \
    --cc=zhiguohong@tencent.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