aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptfc.c
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2010-03-18 09:52:45 -0400
committerJames Bottomley <James.Bottomley@suse.de>2010-04-11 10:24:10 -0400
commit08f5c5c23d52aa385ff304becffb0e0c37cedfe5 (patch)
tree5e6b65987b69ee4c240b413fc682b37935bd13e5 /drivers/message/fusion/mptfc.c
parentf8c23bde85091b696e72d00bc6aa16216a9862f7 (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/mptfc.c')
-rw-r--r--drivers/message/fusion/mptfc.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/message/fusion/mptfc.c b/drivers/message/fusion/mptfc.c
index 8b3ff2d43fb3..b5f03ad81568 100644
--- a/drivers/message/fusion/mptfc.c
+++ b/drivers/message/fusion/mptfc.c
@@ -482,6 +482,7 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
482 if (vtarget) { 482 if (vtarget) {
483 vtarget->id = pg0->CurrentTargetID; 483 vtarget->id = pg0->CurrentTargetID;
484 vtarget->channel = pg0->CurrentBus; 484 vtarget->channel = pg0->CurrentBus;
485 vtarget->deleted = 0;
485 } 486 }
486 } 487 }
487 *((struct mptfc_rport_info **)rport->dd_data) = ri; 488 *((struct mptfc_rport_info **)rport->dd_data) = ri;
@@ -1092,6 +1093,8 @@ mptfc_setup_reset(struct work_struct *work)
1092 container_of(work, MPT_ADAPTER, fc_setup_reset_work); 1093 container_of(work, MPT_ADAPTER, fc_setup_reset_work);
1093 u64 pn; 1094 u64 pn;
1094 struct mptfc_rport_info *ri; 1095 struct mptfc_rport_info *ri;
1096 struct scsi_target *starget;
1097 VirtTarget *vtarget;
1095 1098
1096 /* reset about to happen, delete (block) all rports */ 1099 /* reset about to happen, delete (block) all rports */
1097 list_for_each_entry(ri, &ioc->fc_rports, list) { 1100 list_for_each_entry(ri, &ioc->fc_rports, list) {
@@ -1099,6 +1102,12 @@ mptfc_setup_reset(struct work_struct *work)
1099 ri->flags &= ~MPT_RPORT_INFO_FLAGS_REGISTERED; 1102 ri->flags &= ~MPT_RPORT_INFO_FLAGS_REGISTERED;
1100 fc_remote_port_delete(ri->rport); /* won't sleep */ 1103 fc_remote_port_delete(ri->rport); /* won't sleep */
1101 ri->rport = NULL; 1104 ri->rport = NULL;
1105 starget = ri->starget;
1106 if (starget) {
1107 vtarget = starget->hostdata;
1108 if (vtarget)
1109 vtarget->deleted = 1;
1110 }
1102 1111
1103 pn = (u64)ri->pg0.WWPN.High << 32 | 1112 pn = (u64)ri->pg0.WWPN.High << 32 |
1104 (u64)ri->pg0.WWPN.Low; 1113 (u64)ri->pg0.WWPN.Low;
@@ -1119,6 +1128,8 @@ mptfc_rescan_devices(struct work_struct *work)
1119 int ii; 1128 int ii;
1120 u64 pn; 1129 u64 pn;
1121 struct mptfc_rport_info *ri; 1130 struct mptfc_rport_info *ri;
1131 struct scsi_target *starget;
1132 VirtTarget *vtarget;
1122 1133
1123 /* start by tagging all ports as missing */ 1134 /* start by tagging all ports as missing */
1124 list_for_each_entry(ri, &ioc->fc_rports, list) { 1135 list_for_each_entry(ri, &ioc->fc_rports, list) {
@@ -1146,6 +1157,12 @@ mptfc_rescan_devices(struct work_struct *work)
1146 MPT_RPORT_INFO_FLAGS_MISSING); 1157 MPT_RPORT_INFO_FLAGS_MISSING);
1147 fc_remote_port_delete(ri->rport); /* won't sleep */ 1158 fc_remote_port_delete(ri->rport); /* won't sleep */
1148 ri->rport = NULL; 1159 ri->rport = NULL;
1160 starget = ri->starget;
1161 if (starget) {
1162 vtarget = starget->hostdata;
1163 if (vtarget)
1164 vtarget->deleted = 1;
1165 }
1149 1166
1150 pn = (u64)ri->pg0.WWPN.High << 32 | 1167 pn = (u64)ri->pg0.WWPN.High << 32 |
1151 (u64)ri->pg0.WWPN.Low; 1168 (u64)ri->pg0.WWPN.Low;