From: Alan Stern Date: Fri, 16 Sep 2005 01:52:51 +0000 (-0400) Subject: [SCSI] fix use after potential free in scsi_remove_device X-Git-Tag: firefly_0821_release~41044^2~16 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=541950027f8b7c96a639bc16e48930c590f1b98a;p=firefly-linux-kernel-4.4.55.git [SCSI] fix use after potential free in scsi_remove_device Signed-off-by: Alan Stern Signed-off-by: James Bottomley --- 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);