From: Lee Duncan <lduncan@suse.com>
To: <wu000273@umn.edu>, <kjlu@umn.edu>
Cc: Chris Leech <cleech@redhat.com>,
"James E.J. Bottomley" <jejb@linux.ibm.com>,
"Martin K. Petersen" <martin.petersen@oracle.com>,
<open-iscsi@googlegroups.com>, <linux-scsi@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scsi: Fix reference count leak in iscsi_boot_create_kobj.
Date: Fri, 29 May 2020 08:09:38 -0700 [thread overview]
Message-ID: <2d158fc5-a0b5-718d-d70a-3dfe9db22482@suse.com> (raw)
In-Reply-To: <20200528201353.14849-1-wu000273@umn.edu>
On 5/28/20 1:13 PM, wu000273@umn.edu wrote:
> From: Qiushi Wu <wu000273@umn.edu>
>
> kobject_init_and_add() should be handled when it return an error,
> because 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. Previous
> commit "b8eb718348b8" fixed a similar problem. Thus replace calling
> kfree() by calling kobject_put().
>
> Signed-off-by: Qiushi Wu <wu000273@umn.edu>
> ---
> 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;
>
Reviewed-by: Lee Duncan <lduncan@suse.com>
next prev parent reply other threads:[~2020-05-29 15:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-28 20:13 wu000273
2020-05-29 15:09 ` Lee Duncan [this message]
2020-06-03 2:31 ` Martin K. Petersen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2d158fc5-a0b5-718d-d70a-3dfe9db22482@suse.com \
--to=lduncan@suse.com \
--cc=cleech@redhat.com \
--cc=jejb@linux.ibm.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=open-iscsi@googlegroups.com \
--cc=wu000273@umn.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®