[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 06 Jun 2023 12:47:09 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Asmaa Mnebhi <asmaa@...dia.com>, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org
Cc: netdev@...r.kernel.org, cai.huoqing@...ux.dev, brgl@...ev.pl,
chenhao288@...ilicon.com, huangguangbin2@...wei.com, David Thompson
<davthompson@...dia.com>
Subject: Re: [PATCH net-next v1 1/1] mlxbf_gige: Fix kernel panic at shutdown
On Fri, 2023-06-02 at 14:24 -0400, Asmaa Mnebhi wrote:
> There is a race condition happening during shutdown due to pending napi transactions.
> Since mlxbf_gige_poll is still running, it tries to access a NULL pointer and as a
> result causes a kernel panic.
> To fix this during shutdown, invoke mlxbf_gige_remove to disable and dequeue napi.
>
> Fixes: f92e1869d74e ("Add Mellanox BlueField Gigabit Ethernet driver")
> Signed-off-by: Asmaa Mnebhi <asmaa@...dia.com>
> ---
> drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c | 5 +----
> 1 file changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
> index 694de9513b9f..7017f14595db 100644
> --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
> +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c
> @@ -485,10 +485,7 @@ static int mlxbf_gige_remove(struct platform_device *pdev)
>
> static void mlxbf_gige_shutdown(struct platform_device *pdev)
> {
> - struct mlxbf_gige *priv = platform_get_drvdata(pdev);
> -
> - writeq(0, priv->base + MLXBF_GIGE_INT_EN);
> - mlxbf_gige_clean_port(priv);
> + mlxbf_gige_remove(pdev);
> }
>
> static const struct acpi_device_id __maybe_unused mlxbf_gige_acpi_match[] = {
if the device goes through both shutdown() and remove(), the netdevice
will go through unregister_netdevice() 2 times, which is wrong. Am I
missing something relevant?
Thanks!
Paolo
Powered by blists - more mailing lists