diff options
author | Kashyap, Desai <kashyap.desai@lsi.com> | 2010-03-18 09:52:45 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-04-11 10:24:10 -0400 |
commit | 08f5c5c23d52aa385ff304becffb0e0c37cedfe5 (patch) | |
tree | 5e6b65987b69ee4c240b413fc682b37935bd13e5 /drivers/message/fusion/mptctl.c | |
parent | f8c23bde85091b696e72d00bc6aa16216a9862f7 (diff) |
[SCSI] mptfusion: sanity check for vdevice pointer is added
Added sanity checks before accessing vdevice and added vdevice->deleted
setting for mptfc.
Signed-off-by: Kashyap Desai <kashyap.desai@lsi.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/message/fusion/mptctl.c')
-rw-r--r-- | drivers/message/fusion/mptctl.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptctl.c b/drivers/message/fusion/mptctl.c index e7fab5de16e7..f06b29193b4e 100644 --- a/drivers/message/fusion/mptctl.c +++ b/drivers/message/fusion/mptctl.c | |||
@@ -1329,6 +1329,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size) | |||
1329 | if (ioc->sh) { | 1329 | if (ioc->sh) { |
1330 | shost_for_each_device(sdev, ioc->sh) { | 1330 | shost_for_each_device(sdev, ioc->sh) { |
1331 | vdevice = sdev->hostdata; | 1331 | vdevice = sdev->hostdata; |
1332 | if (vdevice == NULL || vdevice->vtarget == NULL) | ||
1333 | continue; | ||
1332 | if (vdevice->vtarget->tflags & | 1334 | if (vdevice->vtarget->tflags & |
1333 | MPT_TARGET_FLAGS_RAID_COMPONENT) | 1335 | MPT_TARGET_FLAGS_RAID_COMPONENT) |
1334 | continue; | 1336 | continue; |
@@ -1450,6 +1452,8 @@ mptctl_gettargetinfo (unsigned long arg) | |||
1450 | if (!maxWordsLeft) | 1452 | if (!maxWordsLeft) |
1451 | continue; | 1453 | continue; |
1452 | vdevice = sdev->hostdata; | 1454 | vdevice = sdev->hostdata; |
1455 | if (vdevice == NULL || vdevice->vtarget == NULL) | ||
1456 | continue; | ||
1453 | if (vdevice->vtarget->tflags & | 1457 | if (vdevice->vtarget->tflags & |
1454 | MPT_TARGET_FLAGS_RAID_COMPONENT) | 1458 | MPT_TARGET_FLAGS_RAID_COMPONENT) |
1455 | continue; | 1459 | continue; |
@@ -1978,6 +1982,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr) | |||
1978 | struct scsi_target *starget = scsi_target(sdev); | 1982 | struct scsi_target *starget = scsi_target(sdev); |
1979 | VirtTarget *vtarget = starget->hostdata; | 1983 | VirtTarget *vtarget = starget->hostdata; |
1980 | 1984 | ||
1985 | if (vtarget == NULL) | ||
1986 | continue; | ||
1987 | |||
1981 | if ((pScsiReq->TargetID == vtarget->id) && | 1988 | if ((pScsiReq->TargetID == vtarget->id) && |
1982 | (pScsiReq->Bus == vtarget->channel) && | 1989 | (pScsiReq->Bus == vtarget->channel) && |
1983 | (vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)) | 1990 | (vtarget->tflags & MPT_TARGET_FLAGS_Q_YES)) |