lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening linux-cve-announce PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Mon, 4 Aug 2014 11:37:56 +0800 From: <lichunhe@...wei.com> To: <vyasevic@...hat.com>, <xiyou.wangcong@...il.com>, <makita.toshiaki@....ntt.co.jp>, <mst@...hat.com>, <stephen@...workplumber.org>, <ebiederm@...ssion.com>, <f.fainelli@...il.com>, <linux-kernel@...r.kernel.org> CC: <wuyunfei@...wei.com>, <qianhuibin@...wei.com>, Chunhe Li <lichunhe@...wei.com> Subject: [PATCH net/next] bridge:Add rcu read lock when delete br port From: Chunhe Li <lichunhe@...wei.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@...wei.com> --- net/bridge/br_if.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 3eca3fd..91c611d 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -274,9 +274,11 @@ void br_dev_delete(struct net_device *dev, struct list_head *head) struct net_bridge *br = netdev_priv(dev); struct net_bridge_port *p, *n; + rcu_read_lock(); list_for_each_entry_safe(p, n, &br->port_list, list) { del_nbp(p); } + rcu_read_unlock(); br_fdb_delete_by_port(br, NULL, 1); @@ -550,7 +552,9 @@ int br_del_if(struct net_bridge *br, struct net_device *dev) * there still maybe an alternate path for netconsole to use; * therefore there is no reason for a NETDEV_RELEASE event. */ + rcu_read_lock(); del_nbp(p); + rcu_read_unlock(); spin_lock_bh(&br->lock); changed_addr = br_stp_recalculate_bridge_id(br); -- 1.9.2.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@...r.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists