From 4da66721a3e397268fd5070080d44399101ef9e9 Mon Sep 17 00:00:00 2001 From: Asmaa Mnebhi Date: Fri, 2 Jun 2023 13:04:25 -0400 Subject: [PATCH] UBUNTU: SAUCE: mlxbf-gige: Fix kernel panic at shutdown X-NVConfidentiality: public BugLink: https://bugs.launchpad.net/bugs/2022370 We occasionally see a race condition (once every 350 reboots) where napi is still running (mlxbf_gige_poll) while a shutdown has been initiated through "reboot". Since mlxbf_gige_poll is still running, it tries to access a NULL pointer and as a result causes a kernel panic. The fix is to explicitly disable napi and dequeue it during shutdown. mlxbf_gige_remove already calls: unregister_netdev->unregister_netdevice->unregister_netdev_queue-> rollback_registered->rollback_registered_many->dev_close_many-> __dev_close_many->ndo_stop->mlxbf_gige_stop which stops napi So use mlxbf_gige_remove in place of the existing shutdown logic. Signed-off-by: Asmaa Mnebhi Acked-by: Bartlomiej Zolnierkiewicz Acked-by: Tim Gardner Signed-off-by: Bartlomiej Zolnierkiewicz --- 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 602260f2b..b7c1a10c4 100644 --- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c +++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_main.c @@ -500,10 +500,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[] = { -- 2.14.1