Thread (13 messages) 13 messages, 6 authors, 2021-01-11

Re: [PATCH] nvme: hwmon: fix crash on device teardown

From: Daniel Wagner <hidden>
Date: 2021-01-11 16:19:40
Also in: lkml

On Mon, Jan 11, 2021 at 05:00:18PM +0100, Hannes Reinecke wrote:
quoted hunk ↗ jump to hunk
Yeah, using the controller node for devm allocations is quite dodgy.
Does this one help?
diff --git a/drivers/nvme/host/hwmon.c b/drivers/nvme/host/hwmon.c
index 6fdd07fb3001..7260af028cf7 100644
--- a/drivers/nvme/host/hwmon.c
+++ b/drivers/nvme/host/hwmon.c
@@ -226,7 +226,7 @@ static const struct hwmon_chip_info

 int nvme_hwmon_init(struct nvme_ctrl *ctrl)
 {
-       struct device *dev = ctrl->dev;
+       struct device *dev = ctrl->device;
This is what I tried. Yes, it fixes the obvious problem and moves the
hwmon entry under the nvme entry. When the nvme is destroyed, the hwmon
entry is not accessible. But as ctrl->device is not managed by devm the
resources are not freed.


_______________________________________________
Linux-nvme mailing list
Linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help