scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj
authorQiushi Wu <wu000273@umn.edu>
Thu, 28 May 2020 20:13:53 +0000 (15:13 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 Jun 2020 15:50:37 +0000 (17:50 +0200)
commit88d67834843019721d94cd63e077e2499c480d0b
tree186dc3c70e883deabaad45744d815f8f7f698b36
parent08904df10d3a2ea34b1b3b77f8ad9bbebd96507e
scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj

[ Upstream commit 0267ffce562c8bbf9b57ebe0e38445ad04972890 ]

kobject_init_and_add() takes reference even when it fails. If this
function returns an error, kobject_put() must be called to properly
clean up the memory associated with the object.

Link: https://lore.kernel.org/r/20200528201353.14849-1-wu000273@umn.edu
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Qiushi Wu <wu000273@umn.edu>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/iscsi_boot_sysfs.c