Commit af41f9e9 authored by Mike Christie's avatar Mike Christie Committed by James Bottomley

[PATCH] 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.
parent 15902084
......@@ -1080,8 +1080,12 @@ struct scsi_device *scsi_add_device(struct Scsi_Host *shost,
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment