diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2022-11-12 17:43:10 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-18 11:30:22 +0100 |
commit | 76a5041e48766be7310284699169f43d88a90dfb (patch) | |
tree | 1570dee6fa08f825f28a35c7b5210a2e944183dd /sound/pci/ak4531_codec.c | |
parent | 49f63d5699e5a57614dd10c0d2357b8406c9ea4e (diff) | |
download | linux-stable-76a5041e48766be7310284699169f43d88a90dfb.tar.gz linux-stable-76a5041e48766be7310284699169f43d88a90dfb.tar.bz2 linux-stable-76a5041e48766be7310284699169f43d88a90dfb.zip |
scsi: fcoe: Fix possible name leak when device_register() fails
[ Upstream commit 47b6a122c7b69a876c7ee2fc064a26b09627de9d ]
If device_register() returns an error, the name allocated by dev_set_name()
needs to be freed. As the comment of device_register() says, one should use
put_device() to give up the reference in the error path. Fix this by
calling put_device(), then the name can be freed in kobject_cleanup().
The 'fcf' is freed in fcoe_fcf_device_release(), so the kfree() in the
error path can be removed.
The 'ctlr' is freed in fcoe_ctlr_device_release(), so don't use the error
label, just return NULL after calling put_device().
Fixes: 9a74e884ee71 ("[SCSI] libfcoe: Add fcoe_sysfs")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20221112094310.3633291-1-yangyingliang@huawei.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'sound/pci/ak4531_codec.c')
0 files changed, 0 insertions, 0 deletions