mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
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>
This commit is contained in:
parent
5bd3a2e81a
commit
0bda10eb79
@ -360,7 +360,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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user