From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753929Ab3FTHBH (ORCPT ); Thu, 20 Jun 2013 03:01:07 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:36492 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751921Ab3FTHBG (ORCPT ); Thu, 20 Jun 2013 03:01:06 -0400 Message-ID: <51C2A8AA.5010902@gmail.com> Date: Thu, 20 Jun 2013 15:00:58 +0800 From: xiaoming gao User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Eric Dumazet CC: stephen@networkplumber.org, davem@davemloft.net, bridge@lists.linux-foundation.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net bridge: add null pointer check, fix panic References: <51C2710D.2060405@gmail.com> <51C2721B.9050603@gmail.com> <1371704129.3252.356.camel@edumazet-glaptop> In-Reply-To: <1371704129.3252.356.camel@edumazet-glaptop> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Eric Dumazet said, at 2013-6-20 12:55: > On Thu, 2013-06-20 at 11:08 +0800, xiaoming gao wrote: >> From: newtongao >> Date: Wed, 19 Jun 2013 14:58:33 +0800 >> Subject: [PATCH] net bridge: add null pointer check,fix panic >> >> in kernel 3.0, br_port_get_rcu() may return NULL when network interface be deleting from bridge, >> but in function br_handle_frame and br_handle_local_finish, the pointer didn't be checked before using, >> so all br_port_get_rcu callers must do null check,or there occurs the null pointer panic. >> >> kernel 3.4 also has this bug,i have verified. >> mainline kernel still did not check br_port_get_rcu()'s NULL pointer, but i have not tested it yet. > > Please check current version before sending a patch. > > This was most probably fixed in commit 00cfec37484761a44 > ("net: add a synchronize_net() in netdev_rx_handler_unregister()") > > Thanks > > HI Eric the problem is as follow: br_del_if()-->del_nbp(): list_del_rcu(&p->list); dev->priv_flags &= ~IFF_BRIDGE_PORT; ------>at this point, the nic be deleting still have rx_handler , so , may in br_handle_frame() ------>br_port_exists() will return false,so br_get_port_rcu() will return NULL ------>so in br_handle_frame , there will be a null panic. netdev_rx_handler_unregister(dev); synchronize_net(); i have checked commit 00cfec37484761a44, i think it didn't fix this bug.. thanks.