WSL2-Linux-Kernel/drivers/scsi/lpfc
James Smart 0bb97f2486 scsi: lpfc: Fix FCP I/O flush functionality for TMF routines
commit cd8a36a90b upstream.

A prior patch inadvertently caused lpfc_sli_sum_iocb() to exclude counting
of outstanding aborted I/Os and ABORT IOCBs.  Thus,
lpfc_reset_flush_io_context() called from any TMF routine does not properly
wait to flush all outstanding FCP IOCBs leading to a block layer crash on
an invalid scsi_cmnd->request pointer.

  kernel BUG at ../block/blk-core.c:1489!
  RIP: 0010:blk_requeue_request+0xaf/0xc0
  ...
  Call Trace:
  <IRQ>
  __scsi_queue_insert+0x90/0xe0 [scsi_mod]
  blk_done_softirq+0x7e/0x90
  __do_softirq+0xd2/0x280
  irq_exit+0xd5/0xe0
  do_IRQ+0x4c/0xd0
  common_interrupt+0x87/0x87
  </IRQ>

Fix by separating out the LPFC_IO_FCP, LPFC_IO_ON_TXCMPLQ,
LPFC_DRIVER_ABORTED, and CMD_ABORT_XRI_CN || CMD_CLOSE_XRI_CN checks into a
new lpfc_sli_validate_fcp_iocb_for_abort() routine when determining to
build an ABORT iocb.

Restore lpfc_reset_flush_io_context() functionality by including counting
of outstanding aborted IOCBs and ABORT IOCBs in lpfc_sli_sum_iocb().

Link: https://lore.kernel.org/r/20210910233159.115896-9-jsmart2021@gmail.com
Fixes: e136471135 ("scsi: lpfc: Fix illegal memory access on Abort IOCBs")
Cc: <stable@vger.kernel.org> # v5.12+
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2021-11-18 19:15:51 +01:00
..
Makefile
lpfc.h scsi: lpfc: Add cmf_info sysfs entry 2021-08-24 22:56:34 -04:00
lpfc_attr.c scsi: lpfc: Fix gcc -Wstringop-overread warning, again 2021-09-22 00:16:38 -04:00
lpfc_attr.h
lpfc_bsg.c scsi: lpfc: Add bsg support for retrieving adapter cmf data 2021-08-24 22:56:34 -04:00
lpfc_bsg.h scsi: lpfc: Copyright updates for 14.0.0.1 patches 2021-08-24 22:56:34 -04:00
lpfc_compat.h
lpfc_crtn.h scsi: lpfc: Add cmf_info sysfs entry 2021-08-24 22:56:34 -04:00
lpfc_ct.c scsi: lpfc: Add EDC ELS support 2021-08-24 22:56:33 -04:00
lpfc_debugfs.c scsi: lpfc: Add debugfs support for cm framework buffers 2021-08-24 22:56:34 -04:00
lpfc_debugfs.h scsi: lpfc: Copyright updates for 14.0.0.1 patches 2021-08-24 22:56:34 -04:00
lpfc_disc.h scsi: lpfc: Delay unregistering from transport until GIDFT or ADISC completes 2021-07-18 22:30:37 -04:00
lpfc_els.c scsi: lpfc: Don't release final kref on Fport node while ABTS outstanding 2021-11-18 19:15:51 +01:00
lpfc_hbadisc.c scsi: lpfc: Don't release final kref on Fport node while ABTS outstanding 2021-11-18 19:15:51 +01:00
lpfc_hw.h scsi: lpfc: Add EDC ELS support 2021-08-24 22:56:33 -04:00
lpfc_hw4.h scsi: lpfc: Fix CPU to/from endian warnings introduced by ELS processing 2021-09-13 22:15:40 -04:00
lpfc_ids.h scsi: lpfc: Copyright updates for 14.0.0.0 patches 2021-07-27 00:06:41 -04:00
lpfc_init.c scsi: lpfc: Fix compilation errors on kernels with no CONFIG_DEBUG_FS 2021-09-13 22:15:41 -04:00
lpfc_logmsg.h scsi: lpfc: Copyright updates for 14.0.0.1 patches 2021-08-24 22:56:34 -04:00
lpfc_mbox.c scsi: lpfc: Revise Topology and RAS support checks for new adapters 2021-07-27 00:06:41 -04:00
lpfc_mem.c scsi: lpfc: Copyright updates for 14.0.0.1 patches 2021-08-24 22:56:34 -04:00
lpfc_nl.h
lpfc_nportdisc.c scsi: lpfc: Skip issuing ADISC when node is in NPR state 2021-07-18 22:30:37 -04:00
lpfc_nvme.c scsi: lpfc: Don't release final kref on Fport node while ABTS outstanding 2021-11-18 19:15:51 +01:00
lpfc_nvme.h scsi: lpfc: Add cmf_info sysfs entry 2021-08-24 22:56:34 -04:00
lpfc_nvmet.c scsi: lpfc: Fix possible ABBA deadlock in nvmet_xri_aborted() 2021-07-30 23:47:19 -04:00
lpfc_scsi.c scsi: lpfc: Remove unneeded variable 2021-09-13 22:15:42 -04:00
lpfc_scsi.h scsi: lpfc: Copyright updates for 14.0.0.0 patches 2021-07-27 00:06:41 -04:00
lpfc_sli.c scsi: lpfc: Fix FCP I/O flush functionality for TMF routines 2021-11-18 19:15:51 +01:00
lpfc_sli.h scsi: lpfc: Add support for the CM framework 2021-08-24 22:56:34 -04:00
lpfc_sli4.h scsi: lpfc: Add support for the CM framework 2021-08-24 22:56:34 -04:00
lpfc_version.h scsi: lpfc: Update lpfc version to 14.0.0.1 2021-08-24 22:56:34 -04:00
lpfc_vport.c scsi: lpfc: Update copyrights for 12.8.0.7 and 12.8.0.8 changes 2021-03-04 17:37:06 -05:00
lpfc_vport.h