fix oops caused when writing to the rescan attribute
PATCH 1/1 fix oops caused when writing to the rescan attribute
If an upper layer driver is not loaded, and you write to a device's rescan attribute you will get an oops. The attached patch fixes this by testing if the device's driver variable is set before accessing it.
Mike Christie
[email protected]
drivers/scsi/scsi_scan.c +5 -1
@@ -1080,8 +1080,12 @@void scsi_rescan_device (struct device *dev) { -struct scsi_driver *drv =to_scsi_driver (dev->driver); +struct scsi_driver *drv; + +if (!dev->driver) +return ; + drv =to_scsi_driver (dev->driver);if (try_module_get (drv->owner)) {if (drv->rescan) drv->rescan (dev);