From: James Bottomley <James.Bottomley@HansenPartnership.com>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Andrew Morton <akpm@linux-foundation.org>,
SCSI development list <linux-scsi@vger.kernel.org>
Subject: Re: [PATCH (resend)]: SCSI: fix /proc memory leak in the SCSI core
Date: Sun, 22 Feb 2009 11:40:36 -0600 [thread overview]
Message-ID: <1235324436.4531.54.camel@localhost.localdomain> (raw)
In-Reply-To: <Pine.LNX.4.44L0.0902181048210.3186-100000@iolanthe.rowland.org>
On Wed, 2009-02-18 at 10:52 -0500, Alan Stern wrote:
> The SCSI core calls scsi_proc_hostdir_add() from within
> scsi_host_alloc(), but the corresponding scsi_proc_hostdir_rm()
> routine is called from within scsi_remove_host(). As a result, if a
> host is allocated and then deallocated without ever being registered,
> the host's directory in /proc is leaked.
>
> This patch (as1181) fixes this bug in the SCSI core by moving
> scsi_proc_hostdir_add() into scsi_host_add().
>
> Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
>
> ---
>
> Note: This is a repost of a bug-fix patch that was first submitted on
> December 1.
>
> After looking through the documentation and code for the SCSI legacy
> API, I can't find anything incompatible with this change. However I
> don't have any hardware with a legacy driver so I can't actually make
> the test.
OK, but resending a patch you expressed reservations about putting in
without testing doesn't really help me. I need a way to get comfortable
with its safety.
So, what about this alternative fix instead: if the removal were moved
to scsi_host_put(), that would address all the problems and have the
advantage that everyone will test it ...
James
---
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index aa670a1..f4240a8 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -176,7 +176,6 @@ void scsi_remove_host(struct Scsi_Host *shost)
transport_unregister_device(&shost->shost_gendev);
device_unregister(&shost->shost_dev);
device_del(&shost->shost_gendev);
- scsi_proc_hostdir_rm(shost->hostt);
}
EXPORT_SYMBOL(scsi_remove_host);
@@ -493,6 +492,7 @@ EXPORT_SYMBOL(scsi_host_get);
**/
void scsi_host_put(struct Scsi_Host *shost)
{
+ scsi_proc_hostdir_rm(shost->hostt);
put_device(&shost->shost_gendev);
}
EXPORT_SYMBOL(scsi_host_put);
next prev parent reply other threads:[~2009-02-22 17:40 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-18 15:52 [PATCH (resend)]: SCSI: fix /proc memory leak in the SCSI core Alan Stern
2009-02-22 17:40 ` James Bottomley [this message]
2009-02-22 19:34 ` Alan Stern
2009-02-22 19:46 ` James Bottomley
2009-02-23 0:56 ` Alan Stern
-- strict thread matches above, loose matches on Subject: below --
2009-02-27 15:09 Tony Battersby
2009-02-27 21:50 ` Alan Stern
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=1235324436.4531.54.camel@localhost.localdomain \
--to=james.bottomley@hansenpartnership.com \
--cc=akpm@linux-foundation.org \
--cc=linux-scsi@vger.kernel.org \
--cc=stern@rowland.harvard.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