Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 1a0db774 authored by Zenghui Yu's avatar Zenghui Yu Committed by Martin K. Petersen
Browse files

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: ead09dd3

 ("scsi: bsg: Simplify device registration")
Reviewed-by: default avatarJohan Hovold <johan@kernel.org>
Signed-off-by: default avatarZenghui Yu <yuzenghui@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4521428c
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment