[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YtpEiJz26qVoZG8s@kili>
Date: Fri, 22 Jul 2022 09:32:40 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Ido Schimmel <idosch@...dia.com>, Jiri Pirko <jiri@...dia.com>
Cc: Petr Machata <petrm@...dia.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
kernel-janitors@...r.kernel.org
Subject: [PATCH net-next] mlxsw: fix devlink use after frees
Unlock "devlink" before freeing it instead of after.
Fixes: 72a4c8c94efa ("mlxsw: convert driver to use unlocked devlink API during init/fini")
Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
---
drivers/net/ethernet/mellanox/mlxsw/core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlxsw/core.c b/drivers/net/ethernet/mellanox/mlxsw/core.c
index 61eb96b93889..1b61bc8f59a2 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/core.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/core.c
@@ -2296,8 +2296,8 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core,
devl_resources_unregister(devlink);
mlxsw_core->bus->fini(mlxsw_core->bus_priv);
if (!reload) {
- devlink_free(devlink);
devl_unlock(devlink);
+ devlink_free(devlink);
}
return;
@@ -2305,8 +2305,8 @@ void mlxsw_core_bus_device_unregister(struct mlxsw_core *mlxsw_core,
reload_fail_deinit:
mlxsw_core_params_unregister(mlxsw_core);
devl_resources_unregister(devlink);
- devlink_free(devlink);
devl_unlock(devlink);
+ devlink_free(devlink);
}
EXPORT_SYMBOL(mlxsw_core_bus_device_unregister);
--
2.35.1
Powered by blists - more mailing lists