]> git.baikalelectronics.ru Git - kernel.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)
committerDavid S. Miller <davem@davemloft.net>
Fri, 29 Jan 2016 00:21:31 +0000 (16:21 -0800)
commitf4c4db03d52beb3c2683d76b5537645f58e3d905
tree75e57cd0d11cd1cd39eb12784472b1aff6537242
parent6b87503586a01d82d5d5ef056cb548034dc02397
switchdev: Require RTNL mutex to be held when sending FDB notifications

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: 8756fd70406d ("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>
drivers/net/ethernet/mellanox/mlxsw/spectrum.h
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
drivers/net/ethernet/rocker/rocker.c
net/bridge/br.c
net/switchdev/switchdev.c