Skip to content

Commit f8adfb1

Browse files
jsmart-ghgregkh
authored andcommitted
scsi: lpfc: Fix illegal memory access on Abort IOCBs
[ Upstream commit e136471 ] In devloss timer handler and in backend calls to terminate remote port I/O, there is logic to walk through all active IOCBs and validate them to potentially trigger an abort request. This logic is causing illegal memory accesses which leads to a crash. Abort IOCBs, which may be on the list, do not have an associated lpfc_io_buf struct. The driver is trying to map an lpfc_io_buf struct on the IOCB and which results in a bogus address thus the issue. Fix by skipping over ABORT IOCBs (CLOSE IOCBs are ABORTS that don't send ABTS) in the IOCB scan logic. Link: https://lore.kernel.org/r/20210421234433.102079-1-jsmart2021@gmail.com Co-developed-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: Justin Tee <justin.tee@broadcom.com> Signed-off-by: James Smart <jsmart2021@gmail.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 0195e28 commit f8adfb1

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11590,13 +11590,20 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
1159011590
lpfc_ctx_cmd ctx_cmd)
1159111591
{
1159211592
struct lpfc_io_buf *lpfc_cmd;
11593+
IOCB_t *icmd = NULL;
1159311594
int rc = 1;
1159411595

1159511596
if (iocbq->vport != vport)
1159611597
return rc;
1159711598

11598-
if (!(iocbq->iocb_flag & LPFC_IO_FCP) ||
11599-
!(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ))
11599+
if (!(iocbq->iocb_flag & LPFC_IO_FCP) ||
11600+
!(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ) ||
11601+
iocbq->iocb_flag & LPFC_DRIVER_ABORTED)
11602+
return rc;
11603+
11604+
icmd = &iocbq->iocb;
11605+
if (icmd->ulpCommand == CMD_ABORT_XRI_CN ||
11606+
icmd->ulpCommand == CMD_CLOSE_XRI_CN)
1160011607
return rc;
1160111608

1160211609
lpfc_cmd = container_of(iocbq, struct lpfc_io_buf, cur_iocbq);

0 commit comments

Comments
 (0)