From 835b12a5f9c5dfaec3bcd9446369fdad995ee538 Mon Sep 17 00:00:00 2001 From: Sumit Saxena Date: Tue, 12 Mar 2024 06:51:09 +0000 Subject: [PATCH] mrsas: don't reference the removed physical disk of RAID1 during IO submission When a physical disk(PD) [belonging to a RAID1 Virtual disk(VD)] is removed, driver may still use the reference to the removed PD while submitting IO to the controller. Controller firmware faults upon receipt of such IO. This patch fixes this issue by not using any reference to the removed PD. Reviewed by: imp Approved by: imp Sponsored by: Broadcom Inc Differential Revision: https://reviews.freebsd.org/D44282 --- sys/dev/mrsas/mrsas_fp.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/dev/mrsas/mrsas_fp.c b/sys/dev/mrsas/mrsas_fp.c index 9fdb24cc0569..c08558e78b46 100644 --- a/sys/dev/mrsas/mrsas_fp.c +++ b/sys/dev/mrsas/mrsas_fp.c @@ -964,7 +964,8 @@ mr_spanset_get_phy_params(struct mrsas_softc *sc, u_int32_t ld, u_int64_t stripR raid->regTypeReqOnRead != REGION_TYPE_UNUSED))) pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE; else if (raid->level == 1) { - pd = MR_ArPdGet(arRef, physArm + 1, map); + physArm++; + pd = MR_ArPdGet(arRef, physArm, map); if (pd != MR_PD_INVALID) { *pDevHandle = MR_PdDevHandleGet(pd, map); *pPdInterface = MR_PdInterfaceTypeGet(pd, map); @@ -1711,7 +1712,8 @@ MR_GetPhyParams(struct mrsas_softc *sc, u_int32_t ld, pRAID_Context->regLockFlags = REGION_TYPE_EXCLUSIVE; else if (raid->level == 1) { /* Get Alternate Pd. */ - pd = MR_ArPdGet(arRef, physArm + 1, map); + physArm++; + pd = MR_ArPdGet(arRef, physArm, map); if (pd != MR_PD_INVALID) { /* Get dev handle from Pd. */ *pDevHandle = MR_PdDevHandleGet(pd, map);