diff options
author | Zenghui Yu <yuzenghui@huawei.com> | 2021-09-11 18:53:06 +0800 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2021-09-14 00:22:15 -0400 |
commit | 1a0db7744e453844aa2db3f2959aea4a378025ea (patch) | |
tree | 6443fd0b512cfb40c33edc2e28dee165409120dc /samples/hidraw | |
parent | 4521428c48118b0f5f7a637ce7dedd76c29bcdaa (diff) | |
download | linux-1a0db7744e453844aa2db3f2959aea4a378025ea.tar.gz linux-1a0db7744e453844aa2db3f2959aea4a378025ea.tar.bz2 linux-1a0db7744e453844aa2db3f2959aea4a378025ea.zip |
scsi: bsg: Fix device unregistration
device_initialize() is used to take a refcount on the device. However,
put_device() is not called during device teardown. This leads to a
leak of 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.
Fix memory leaks during unregistration and implement a release
function.
Link: https://lore.kernel.org/r/20210911105306.1511-1-yuzenghui@huawei.com
Fixes: ead09dd3aed5 ("scsi: bsg: Simplify device registration")
Reviewed-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Zenghui Yu <yuzenghui@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'samples/hidraw')
0 files changed, 0 insertions, 0 deletions