]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/device_handler/scsi_dh_hp_sw.c
scsi_dh: Verify "dev" is a sdev before accessing it.
[linux-2.6-omap-h63xx.git] / drivers / scsi / device_handler / scsi_dh_hp_sw.c
index 12ceab7b366297fee5bad7ada6d3d7143d00fe2f..ae6be87d6a8327d8b523236c0d3aadf1622f63c1 100644 (file)
@@ -131,11 +131,16 @@ static int hp_sw_bus_notify(struct notifier_block *nb,
                            unsigned long action, void *data)
 {
        struct device *dev = data;
-       struct scsi_device *sdev = to_scsi_device(dev);
+       struct scsi_device *sdev;
        struct scsi_dh_data *scsi_dh_data;
        int i, found = 0;
        unsigned long flags;
 
+       if (!scsi_is_sdev_device(dev))
+               return 0;
+
+       sdev = to_scsi_device(dev);
+
        if (action == BUS_NOTIFY_ADD_DEVICE) {
                for (i = 0; hp_sw_dh_data_list[i].vendor; i++) {
                        if (!strncmp(sdev->vendor, hp_sw_dh_data_list[i].vendor,