[SRU][F/J:linux-bluefield][PATCH v1 2/2] UBUNTU: SAUCE: mlxbf-gige: Fix kernel panic after reboot

Asmaa Mnebhi asmaa at nvidia.com
Tue Aug 8 14:00:25 UTC 2023


BugLink: https://bugs.launchpad.net/bugs/2030765

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.

Add a check for when "priv" is NULL.

Signed-off-by: Asmaa Mnebhi <asmaa at nvidia.com>
---
 drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c
index f21dafde490b..75466f713ade 100644
--- a/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c
+++ b/drivers/net/ethernet/mellanox/mlxbf_gige/mlxbf_gige_rx.c
@@ -298,6 +298,9 @@ int mlxbf_gige_poll(struct napi_struct *napi, int budget)
 
 	priv = container_of(napi, struct mlxbf_gige, napi);
 
+	if (!priv)
+		return 0;
+
 	mlxbf_gige_handle_tx_complete(priv);
 
 	data = readq(priv->base + MLXBF_GIGE_RX_DMA);
-- 
2.30.1




More information about the kernel-team mailing list