Skip to content

Commit e136471

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
scsi: lpfc: Fix illegal memory access on Abort IOCBs
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/[email protected] Co-developed-by: Justin Tee <[email protected]> Signed-off-by: Justin Tee <[email protected]> Signed-off-by: James Smart <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 8536704 commit e136471

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11804,13 +11804,20 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
1180411804
lpfc_ctx_cmd ctx_cmd)
1180511805
{
1180611806
struct lpfc_io_buf *lpfc_cmd;
11807+
IOCB_t *icmd = NULL;
1180711808
int rc = 1;
1180811809

1180911810
if (!iocbq || iocbq->vport != vport)
1181011811
return rc;
1181111812

11812-
if (!(iocbq->iocb_flag & LPFC_IO_FCP) ||
11813-
!(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ))
11813+
if (!(iocbq->iocb_flag & LPFC_IO_FCP) ||
11814+
!(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ) ||
11815+
iocbq->iocb_flag & LPFC_DRIVER_ABORTED)
11816+
return rc;
11817+
11818+
icmd = &iocbq->iocb;
11819+
if (icmd->ulpCommand == CMD_ABORT_XRI_CN ||
11820+
icmd->ulpCommand == CMD_CLOSE_XRI_CN)
1181411821
return rc;
1181511822

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

0 commit comments

Comments
 (0)