提交 7ca44be9 编写于 作者: J James Smart 提交者: Zheng Zengkai

scsi: lpfc: Fix illegal memory access on Abort IOCBs

stable inclusion
from stable-5.10.39
commit f8adfb1d370f035e1790a3d1a5e8a99ff0687bdd
bugzilla: 51881
CVE: NA

--------------------------------

[ Upstream commit e1364711 ]

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.comCo-developed-by: NJustin Tee <justin.tee@broadcom.com>
Signed-off-by: NJustin Tee <justin.tee@broadcom.com>
Signed-off-by: NJames Smart <jsmart2021@gmail.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: NWeilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 d6ac1b7e
...@@ -11590,13 +11590,20 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport, ...@@ -11590,13 +11590,20 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
lpfc_ctx_cmd ctx_cmd) lpfc_ctx_cmd ctx_cmd)
{ {
struct lpfc_io_buf *lpfc_cmd; struct lpfc_io_buf *lpfc_cmd;
IOCB_t *icmd = NULL;
int rc = 1; int rc = 1;
if (iocbq->vport != vport) if (iocbq->vport != vport)
return rc; return rc;
if (!(iocbq->iocb_flag & LPFC_IO_FCP) || if (!(iocbq->iocb_flag & LPFC_IO_FCP) ||
!(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ)) !(iocbq->iocb_flag & LPFC_IO_ON_TXCMPLQ) ||
iocbq->iocb_flag & LPFC_DRIVER_ABORTED)
return rc;
icmd = &iocbq->iocb;
if (icmd->ulpCommand == CMD_ABORT_XRI_CN ||
icmd->ulpCommand == CMD_CLOSE_XRI_CN)
return rc; return rc;
lpfc_cmd = container_of(iocbq, struct lpfc_io_buf, cur_iocbq); lpfc_cmd = container_of(iocbq, struct lpfc_io_buf, cur_iocbq);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册