From: Alex Vesker Date: Mon, 25 Jul 2016 12:42:13 +0000 (+0300) Subject: net/mlx4_core: Check device state before unregistering it X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9b022a6e0f26af108b9105b16b310393c898d9bd;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git net/mlx4_core: Check device state before unregistering it Verify that the device state is registered before un-registering it. This check is required to prevent an OOPS on flows that do re-registration of the device and its previous state was unregistered. Fixes: 225c7b1feef1 ("IB/mlx4: Add a driver Mellanox ConnectX InfiniBand adapters") Signed-off-by: Alex Vesker Signed-off-by: Tariq Toukan Signed-off-by: David S. Miller --- diff --git a/drivers/net/ethernet/mellanox/mlx4/intf.c b/drivers/net/ethernet/mellanox/mlx4/intf.c index 7ae1cdad9bf0..0e8b7c44931f 100644 --- a/drivers/net/ethernet/mellanox/mlx4/intf.c +++ b/drivers/net/ethernet/mellanox/mlx4/intf.c @@ -218,6 +218,9 @@ void mlx4_unregister_device(struct mlx4_dev *dev) struct mlx4_priv *priv = mlx4_priv(dev); struct mlx4_interface *intf; + if (!(dev->persist->interface_state & MLX4_INTERFACE_STATE_UP)) + return; + mlx4_stop_catas_poll(dev); mutex_lock(&intf_mutex);