diff options
author | Qiushi Wu <[email protected]> | 2020-05-28 15:13:53 -0500 |
---|---|---|
committer | Martin K. Petersen <[email protected]> | 2020-06-02 21:23:47 -0400 |
commit | 0267ffce562c8bbf9b57ebe0e38445ad04972890 (patch) | |
tree | aacfb8a2f3305d7eca7c1659f627f05c4125f381 | |
parent | 8c4e0f212398cdd1eb4310a5981d06a723cdd24f (diff) |
scsi: iscsi: Fix reference count leak in iscsi_boot_create_kobj
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/[email protected]
Reviewed-by: Lee Duncan <[email protected]>
Signed-off-by: Qiushi Wu <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
-rw-r--r-- | drivers/scsi/iscsi_boot_sysfs.c | 2 |
1 files changed, 1 insertions, 1 deletions
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; |