[SRU][F:linux-bluefield][PATCH v1 2/3] UBUNTU: SAUCE: pwr-mlxbf.c: rmmod results in kernel panic due to access to NULL pointer

Asmaa Mnebhi asmaa at nvidia.com
Mon Oct 30 20:05:46 UTC 2023


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

The bug is due to accessing a NULL pointer priv when flushing.
Call "platform_set_drvdata()" to initialize the data struct in
pdev. This way, when it is called from the remove function, it is not NULL.

Signed-off-by: Asmaa Mnebhi <asmaa at nvidia.com>
---
 drivers/power/reset/pwr-mlxbf.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/power/reset/pwr-mlxbf.c b/drivers/power/reset/pwr-mlxbf.c
index ba40c964d8bb..683bf38ba582 100644
--- a/drivers/power/reset/pwr-mlxbf.c
+++ b/drivers/power/reset/pwr-mlxbf.c
@@ -72,6 +72,8 @@ pwr_mlxbf_probe(struct platform_device *pdev)
 
 	INIT_WORK(&priv->send_work, pwr_mlxbf_send_work);
 
+	platform_set_drvdata(pdev, priv);
+
 	err = devm_request_irq(dev, irq, pwr_mlxbf_irq, 0, hid, priv);
 	if (err)
 		dev_err(dev, "Failed request of %s irq\n", priv->hid);
-- 
2.30.1




More information about the kernel-team mailing list