From: Dave Jones <davej@redhat.com>
To: Brian King <brking@us.ibm.com>
Cc: linux-scsi@vger.kernel.org
Subject: Re: two leaks in scsi_alloc_sdev failure paths
Date: Thu, 9 Mar 2006 10:21:27 -0500 [thread overview]
Message-ID: <20060309152126.GA30809@redhat.com> (raw)
In-Reply-To: <441044B6.3000802@us.ibm.com>
On Thu, Mar 09, 2006 at 09:07:34AM -0600, Brian King wrote:
> Dave Jones wrote:
> >If the scsi_alloc_queue or the slave_alloc calls in scsi_alloc_device fail,
> >we forget to release the locally allocated sdev on the failure path.
>
> Actually, I think the slave_alloc failure path works today, and this patch
> breaks it. Today, in the slave_alloc failure path, the release function
> called
> as a result of the put_device in out_device_destroy should end up freeing
> the sdev.
Correct, thanks.
> Rather than this change, I think just adding a kfree(sdev) before the goto
> out would accomplish what you want.
looks a lot simpler.
Thanks.
Dave
If the scsi_alloc_queue or the slave_alloc calls in scsi_alloc_device fail,
we forget to release the locally allocated sdev on the failure path.
Coverity #609
Signed-off-by: Dave Jones <davej@redhat.com>
--- linux-2.6/drivers/scsi/scsi_scan.c~ 2006-03-09 10:19:51.000000000 -0500
+++ linux-2.6/drivers/scsi/scsi_scan.c 2006-03-09 10:20:20.000000000 -0500
@@ -252,6 +252,7 @@ static struct scsi_device *scsi_alloc_sd
/* release fn is set up in scsi_sysfs_device_initialise, so
* have to free and put manually here */
put_device(&starget->dev);
+ kfree(sdev);
goto out;
}
--
http://www.codemonkey.org.uk
prev parent reply other threads:[~2006-03-09 15:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-09 3:36 two leaks in scsi_alloc_sdev failure paths Dave Jones
2006-03-09 15:07 ` Brian King
2006-03-09 15:21 ` Dave Jones [this message]
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=20060309152126.GA30809@redhat.com \
--to=davej@redhat.com \
--cc=brking@us.ibm.com \
--cc=linux-scsi@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.