When a new SCSI disk is created we should be checking if the parent device is actually present before proceeding with probing. Signed-off-by: Hannes Reinecke <hare@xxxxxxxx> --- drivers/scsi/sd.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index ab75ebd..228b0b62 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -3399,6 +3399,10 @@ static int sd_probe(struct device *dev) } device_initialize(&sdkp->dev); + + if (!get_device(dev)) + goto out_free_index; + sdkp->dev.parent = dev; sdkp->dev.class = &sd_disk_class; dev_set_name(&sdkp->dev, "%s", dev_name(dev)); @@ -3407,7 +3411,6 @@ static int sd_probe(struct device *dev) if (error) goto out_free_index; - get_device(dev); dev_set_drvdata(dev, sdkp); get_device(&sdkp->dev); /* prevent release before async_schedule */ -- 1.8.5.6