[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YTmdRQ6BwPTWWn/Y@kroah.com>
Date: Thu, 9 Sep 2021 07:36:05 +0200
From: Greg KH <gregkh@...uxfoundation.org>
To: Zenghui Yu <yuzenghui@...wei.com>
Cc: linux-scsi@...r.kernel.org, linux-block@...r.kernel.org,
linux-kernel@...r.kernel.org, fujita.tomonori@....ntt.co.jp,
axboe@...nel.dk, martin.petersen@...cle.com, hch@....de,
wanghaibin.wang@...wei.com
Subject: Re: [PATCH] scsi: bsg: Fix device unregistration
On Thu, Sep 09, 2021 at 11:46:08AM +0800, Zenghui Yu wrote:
> We use device_initialize() to take refcount for the device but forget to
> put_device() on device teardown, which ends up leaking private data of the
> driver core, dev_name(), etc. This is reported by kmemleak at boot time if
> we compile kernel with DEBUG_TEST_DRIVER_REMOVE.
>
> Note that adding the missing put_device() is _not_ sufficient to fix device
> unregistration. As we don't provide the .release() method for device, which
> turned out to be typically wrong and will be complained loudly by the
> driver core.
>
> Fix both of them.
>
> Fixes: ead09dd3aed5 ("scsi: bsg: Simplify device registration")
> Signed-off-by: Zenghui Yu <yuzenghui@...wei.com>
> ---
> block/bsg.c | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
Reviewed-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Powered by blists - more mailing lists