[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210111161857.okecoo4h4b4prpic@beryllium.lan>
Date: Mon, 11 Jan 2021 17:18:57 +0100
From: Daniel Wagner <dwagner@...e.de>
To: Hannes Reinecke <hare@...e.de>
Cc: Enzo Matsumiya <ematsumiya@...e.de>,
Sagi Grimberg <sagi@...mberg.me>, linux-kernel@...r.kernel.org,
linux-nvme@...ts.infradead.org, Jens Axboe <axboe@...com>,
Keith Busch <kbusch@...nel.org>, Christoph Hellwig <hch@....de>
Subject: Re: [PATCH] nvme: hwmon: fix crash on device teardown
On Mon, Jan 11, 2021 at 05:00:18PM +0100, Hannes Reinecke wrote:
> 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.
Powered by blists - more mailing lists