diff options
author | Chandra Seetharaman <sekharan@us.ibm.com> | 2008-07-16 17:35:08 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-16 17:54:21 -0700 |
commit | 33af79d12e0fa25545d49e86afc67ea8ad5f2f40 (patch) | |
tree | 9e76151b895d102d1978df3afc58248a2adbf5dd /drivers/scsi/device_handler/scsi_dh_emc.c | |
parent | dc7c65db2845a8d17432d89252c4227a9a7cb15f (diff) | |
download | linux-33af79d12e0fa25545d49e86afc67ea8ad5f2f40.tar.bz2 |
scsi_dh: Verify "dev" is a sdev before accessing it.
Before accessing the device data structure in hardware handlers,
make sure it is a indeed a sdev device.
Yinghai Lu <yhlu.kernel@gmail.com> found the bug on Jul 16, 2008,
and later tested/verified the following fix.
Signed-off-by: Chandra Seetharaman <sekharan@us.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/scsi/device_handler/scsi_dh_emc.c')
-rw-r--r-- | drivers/scsi/device_handler/scsi_dh_emc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/scsi/device_handler/scsi_dh_emc.c b/drivers/scsi/device_handler/scsi_dh_emc.c index ed53f14007a2..f2467e936e55 100644 --- a/drivers/scsi/device_handler/scsi_dh_emc.c +++ b/drivers/scsi/device_handler/scsi_dh_emc.c @@ -416,12 +416,17 @@ static int clariion_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; struct clariion_dh_data *h; 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; clariion_dev_list[i].vendor; i++) { if (!strncmp(sdev->vendor, clariion_dev_list[i].vendor, |