summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_sysfs.c
diff options
context:
space:
mode:
authorAlan Stern2005-09-16 03:52:51 +0200
committerJames Bottomley2005-09-16 04:03:54 +0200
commit541950027f8b7c96a639bc16e48930c590f1b98a (patch)
tree69d367dab3f738c888bf16646ed85cde69e3bf2a /drivers/scsi/scsi_sysfs.c
parent[SCSI] atp870u: fix memory addressing bug (diff)
downloadkernel-qcow2-linux-541950027f8b7c96a639bc16e48930c590f1b98a.tar.gz
kernel-qcow2-linux-541950027f8b7c96a639bc16e48930c590f1b98a.tar.xz
kernel-qcow2-linux-541950027f8b7c96a639bc16e48930c590f1b98a.zip
[SCSI] fix use after potential free in scsi_remove_device
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_sysfs.c')
-rw-r--r--drivers/scsi/scsi_sysfs.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
index b8052d5206cc..83f87c41b18d 100644
--- a/drivers/scsi/scsi_sysfs.c
+++ b/drivers/scsi/scsi_sysfs.c
@@ -707,9 +707,11 @@ void __scsi_remove_device(struct scsi_device *sdev)
**/
void scsi_remove_device(struct scsi_device *sdev)
{
- down(&sdev->host->scan_mutex);
+ struct Scsi_Host *shost = sdev->host;
+
+ down(&shost->scan_mutex);
__scsi_remove_device(sdev);
- up(&sdev->host->scan_mutex);
+ up(&shost->scan_mutex);
}
EXPORT_SYMBOL(scsi_remove_device);