]> git.karo-electronics.de Git - karo-tx-linux.git/commit
switchdev: Require RTNL mutex to be held when sending FDB notifications
authorIdo Schimmel <idosch@mellanox.com>
Wed, 27 Jan 2016 14:16:43 +0000 (15:16 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Mar 2016 23:07:04 +0000 (15:07 -0800)
commitba50e6d96f3daf3db8396cc3529f90339d9ef59a
treeac3bc9d426bfecc2ab1517403c4e55a4960abe92
parent649dc6c32e516972128502ad6a45a16b96098567
switchdev: Require RTNL mutex to be held when sending FDB notifications

[ Upstream commit 4f2c6ae5c64c353fb1b0425e4747e5603feadba1 ]

When switchdev drivers process FDB notifications from the underlying
device they resolve the netdev to which the entry points to and notify
the bridge using the switchdev notifier.

However, since the RTNL mutex is not held there is nothing preventing
the netdev from disappearing in the middle, which will cause
br_switchdev_event() to dereference a non-existing netdev.

Make switchdev drivers hold the lock at the beginning of the
notification processing session and release it once it ends, after
notifying the bridge.

Also, remove switchdev_mutex and fdb_lock, as they are no longer needed
when RTNL mutex is held.

Fixes: 03bf0c281234 ("switchdev: introduce switchdev notifier")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
drivers/net/ethernet/rocker/rocker.c
net/bridge/br.c
net/switchdev/switchdev.c