linux/drivers/scsi/mpt3sas
Sreekanth Reddy c2fe742ff6 scsi: mpt3sas: Fix kernel panic during expander reset
During expander reset handling, the driver invokes kernel function
scsi_host_find_tag() to obtain outstanding requests associated with the
scsi host managed by the driver. Driver loops from tag value zero to hba
queue depth to obtain the outstanding scmds. But when blk-mq is enabled,
the block layer may return stale entry for one or more requests. This may
lead to kernel panic if the returned value is inaccessible or the memory
pointed by the returned value is reused.

Reference of upstream discussion:

	https://patchwork.kernel.org/patch/10734933/

Instead of calling scsi_host_find_tag() API for each and every smid (smid
is tag +1) from one to shost->can_queue, now driver will call this API (to
obtain the outstanding scmd) only for those smid's which are outstanding at
the driver level.

Driver will determine whether this smid is outstanding at driver level by
looking into it's corresponding MPI request frame, if its MPI request frame
is empty, then it means that this smid is free and does not need to call
scsi_host_find_tag() for it.  By doing this, driver will invoke
scsi_host_find_tag() for only those tags which are outstanding at the
driver level.

Driver will check whether particular MPI request frame is empty or not by
looking into the "DevHandle" field. If this field is zero then it means
that this MPI request is empty. For active MPI request DevHandle must be
non-zero.

Also driver will memset the MPI request frame once the corresponding scmd
is processed (i.e. just before calling
scmd->done function).

Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2019-03-25 21:53:48 -04:00
..
mpi scsi: mpt3sas: Add support for NVMe Switch Adapter 2019-02-04 22:52:21 -05:00
Kconfig mpt3sas: fix Kconfig dependency problem for mpt2sas back compatibility 2015-12-03 09:31:23 -08:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
mpt3sas_base.c scsi: mpt3sas: Fix kernel panic during expander reset 2019-03-25 21:53:48 -04:00
mpt3sas_base.h scsi: mpt3sas: Update driver version to 27.102.00.00 2019-02-04 22:52:21 -05:00
mpt3sas_config.c scsi: mpt3sas: fix spelling mistake "manufaucturing" -> "manufacturing" 2018-11-28 21:37:38 -05:00
mpt3sas_ctl.c scsi: mpt3sas: Separate out mpt3sas_wait_for_ioc 2018-11-06 20:16:01 -05:00
mpt3sas_ctl.h scsi: mpt3sas: Increase event log buffer to support 24 port HBA's. 2018-05-08 00:34:20 -04:00
mpt3sas_debug.h mpt2sas, mpt3sas: Remove SCSI_MPTXSAS_LOGGING entry from Kconfig 2015-11-11 18:31:14 -05:00
mpt3sas_scsih.c scsi: mpt3sas: Fix kernel panic during expander reset 2019-03-25 21:53:48 -04:00
mpt3sas_transport.c scsi: mpt3sas: Call sas_remove_host before removing the target devices 2018-11-06 20:16:01 -05:00
mpt3sas_trigger_diag.c scsi: mpt3sas: Convert uses of pr_<level> with MPT3SAS_FMT to ioc_<level> 2018-10-10 22:00:43 -04:00
mpt3sas_trigger_diag.h
mpt3sas_warpdrive.c scsi: mpt3sas: Convert uses of pr_<level> with MPT3SAS_FMT to ioc_<level> 2018-10-10 22:00:43 -04:00