[SCSI] fix oops in all legacy host adapters caused by 6f381fa
authorJames Bottomley <jbottomley@parallels.com>
Fri, 4 May 2012 09:40:04 +0000 (09:40 +0000)
committerJames Bottomley <JBottomley@Parallels.com>
Thu, 10 May 2012 07:24:13 +0000 (08:24 +0100)
Commit 6f381fa344911d5a234b13574433cf23036f9467
Author: Lin Ming <ming.m.lin@intel.com>

[SCSI] scsi_lib: use correct DMA device in __scsi_alloc_queue

Caused a regression where we oops in every legacy mode SCSI host driver
because they supply a NULL pointer to scsi_add_host().  Fix this by checking
for the NULL in scsi_add_host_with_dma() and changing the DMA device to being
the platform_bus in that case (which replicates the original behaviour).

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/hosts.c

index 351dc0b86fab72dd788807589f7a699e49f480ae..a3a056a9db67bffb694208d30c44f4807c843a7a 100644 (file)
@@ -218,6 +218,9 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
 
        if (!shost->shost_gendev.parent)
                shost->shost_gendev.parent = dev ? dev : &platform_bus;
+       if (!dma_dev)
+               dma_dev = shost->shost_gendev.parent;
+
        shost->dma_dev = dma_dev;
 
        error = device_add(&shost->shost_gendev);