aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Jacob <mjacob@FreeBSD.org>2006-02-02 09:02:16 +0000
committerMatt Jacob <mjacob@FreeBSD.org>2006-02-02 09:02:16 +0000
commitb7918ba53ac07ff93474382137b4bc045f78aac6 (patch)
treef327f8ef84765d64e8a8f871047663da46b26c6f
parent68ce4375c4af78251123a03761d3424e7a96e425 (diff)
downloadsrc-b7918ba53ac07ff93474382137b4bc045f78aac6.tar.gz
src-b7918ba53ac07ff93474382137b4bc045f78aac6.zip
Make sure we don't pick up a loopid that's larger than our
current portdb max (MAX_FC_TARG == 256) now that we support 2K Login f/w. MFC after: 3 days
Notes
Notes: svn path=/head/; revision=155206
-rw-r--r--sys/dev/isp/isp.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/dev/isp/isp.c b/sys/dev/isp/isp.c
index a9666e9e51ea..a1f4ac01e581 100644
--- a/sys/dev/isp/isp.c
+++ b/sys/dev/isp/isp.c
@@ -1688,6 +1688,12 @@ isp_fclink_test(struct ispsoftc *isp, int usdelay)
return (-1);
}
fcp->isp_loopid = mbs.param[1];
+ if (fcp->isp_loopid == 0xffff) { /* happens with 2k login f/w */
+ fcp->isp_loopid = MAX_FC_TARG-1;
+ } else if (fcp->isp_loopid >= MAX_FC_TARG) {
+ isp_prt(isp, ISP_LOGWARN, "bad initiator loopid (0x%x)", fcp->isp_loopid);
+ fcp->isp_loopid = MAX_FC_TARG-1;
+ }
if (IS_2200(isp) || IS_23XX(isp)) {
int topo = (int) mbs.param[6];
if (topo < TOPO_NL_PORT || topo > TOPO_PTP_STUB)
@@ -1697,10 +1703,9 @@ isp_fclink_test(struct ispsoftc *isp, int usdelay)
fcp->isp_topo = TOPO_NL_PORT;
}
/*
- * XXX: We can get the AL_PA (low 8 bits) from here.
- * XXX: Where do we get the upper 16 bits?
+ * Get the port id.
*/
- fcp->isp_portid = mbs.param[2] & 0xff;
+ fcp->isp_portid = mbs.param[2] | (mbs.param[3] << 16);
/*
* Check to see if we're on a fabric by trying to see if we
@@ -2064,6 +2069,10 @@ isp_pdb_sync(struct ispsoftc *isp)
*/
if (mbs.param[1] != 0) {
loopid = mbs.param[1];
+ if (loopid >= MAX_FC_TARG) {
+ loopid = MAX_FC_TARG;
+ break;
+ }
isp_prt(isp, ISP_LOGINFO, retained,
loopid, (int) (lp - fcp->portdb),
lp->portid);