aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2009-02-27 16:51:42 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-03-12 13:58:17 -0400
commit77c019768f0607c36e25bec11ce3e1eabef09277 (patch)
tree7a8a5382a3be5c2662dcab8e726a3dcc94d6d924 /drivers
parent058bb82c5628c88af802c19e2b56ae43551552d5 (diff)
[SCSI] fix /proc memory leak in the SCSI core
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 (as1181b) fixes this bug in the SCSI core by moving scsi_proc_hostdir_rm() into scsi_host_dev_release(). Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/scsi/hosts.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index aa670a1d1513..89d41a424b33 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -176,7 +176,6 @@ void scsi_remove_host(struct Scsi_Host *shost)
176 transport_unregister_device(&shost->shost_gendev); 176 transport_unregister_device(&shost->shost_gendev);
177 device_unregister(&shost->shost_dev); 177 device_unregister(&shost->shost_dev);
178 device_del(&shost->shost_gendev); 178 device_del(&shost->shost_gendev);
179 scsi_proc_hostdir_rm(shost->hostt);
180} 179}
181EXPORT_SYMBOL(scsi_remove_host); 180EXPORT_SYMBOL(scsi_remove_host);
182 181
@@ -270,6 +269,8 @@ static void scsi_host_dev_release(struct device *dev)
270 struct Scsi_Host *shost = dev_to_shost(dev); 269 struct Scsi_Host *shost = dev_to_shost(dev);
271 struct device *parent = dev->parent; 270 struct device *parent = dev->parent;
272 271
272 scsi_proc_hostdir_rm(shost->hostt);
273
273 if (shost->ehandler) 274 if (shost->ehandler)
274 kthread_stop(shost->ehandler); 275 kthread_stop(shost->ehandler);
275 if (shost->work_q) 276 if (shost->work_q)