Sasha Levin
unread,Jun 17, 2020, 9:15:04 PM6/17/20Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to linux-...@vger.kernel.org, sta...@vger.kernel.org, Qiushi Wu, Lee Duncan, Martin K . Petersen, Sasha Levin, open-...@googlegroups.com, linux...@vger.kernel.org
From: Qiushi Wu <
wu00...@umn.edu>
[ 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....@umn.edu
Reviewed-by: Lee Duncan <
ldu...@suse.com>
Signed-off-by: Qiushi Wu <
wu00...@umn.edu>
Signed-off-by: Martin K. Petersen <
martin....@oracle.com>
Signed-off-by: Sasha Levin <
sas...@kernel.org>
---
drivers/scsi/iscsi_boot_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
index e4857b728033..a64abe38db2d 100644
--- a/drivers/scsi/iscsi_boot_sysfs.c
+++ b/drivers/scsi/iscsi_boot_sysfs.c
@@ -352,7 +352,7 @@ iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset,
boot_kobj->kobj.kset = boot_kset->kset;
if (kobject_init_and_add(&boot_kobj->kobj, &iscsi_boot_ktype,
NULL, name, index)) {
- kfree(boot_kobj);
+ kobject_put(&boot_kobj->kobj);
return NULL;
}
boot_kobj->data = data;
--
2.25.1