mlxsw: spectrum: Avoid possible NULL pointer dereference
authorIdo Schimmel <idosch@mellanox.com>
Thu, 18 May 2017 11:03:52 +0000 (13:03 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 13 Apr 2018 17:48:01 +0000 (19:48 +0200)
commitc8799579ff4b1970c519ab664dffca1e9d1198de
tree24dfaca58f16698ac01aba8803fa04b1321f7f12
parenteed386e2e286f1d187b293b84ab53d0740b549c3
mlxsw: spectrum: Avoid possible NULL pointer dereference

[ Upstream commit c0e01eac7ada785fdeaea1ae5476ec1cf3b00374 ]

In case we got an FDB notification for a port that doesn't exist we
execute an FDB entry delete to prevent it from re-appearing the next
time we poll for notifications.

If the operation failed we would trigger a NULL pointer dereference as
'mlxsw_sp_port' is NULL.

Fix it by reporting the error using the underlying bus device instead.

Fixes: 12f1501e7511 ("mlxsw: spectrum: remove FDB entry in case we get unknown object notification")
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: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c