linux-stable/drivers/scsi/pm8001
John Garry df7abcaa12 scsi: pm8001: Fix use-after-free for aborted SSP/STP sas_task
Currently a use-after-free may occur if a sas_task is aborted by the upper
layer before we handle the I/O completion in mpi_ssp_completion() or
mpi_sata_completion().

In this case, the following are the two steps in handling those I/O
completions:

 - Call complete() to inform the upper layer handler of completion of
   the I/O.

 - Release driver resources associated with the sas_task in
   pm8001_ccb_task_free() call.

When complete() is called, the upper layer may free the sas_task. As such,
we should not touch the associated sas_task afterwards, but we do so in the
pm8001_ccb_task_free() call.

Fix by swapping the complete() and pm8001_ccb_task_free() calls ordering.

Link: https://lore.kernel.org/r/1643289172-165636-4-git-send-email-john.garry@huawei.com
Reviewed-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
2022-01-31 16:40:07 -05:00
..
Makefile scsi: pm80xx: Add tracepoints 2021-11-18 22:26:58 -05:00
pm80xx_hwi.c scsi: pm8001: Fix use-after-free for aborted SSP/STP sas_task 2022-01-31 16:40:07 -05:00
pm80xx_hwi.h scsi: pm8001: Fix bogus FW crash for maxcpus=1 2022-01-24 23:30:27 -05:00
pm80xx_tracepoints.c scsi: pm80xx: Add tracepoints 2021-11-18 22:26:58 -05:00
pm80xx_tracepoints.h scsi: pm80xx: Add pm80xx_mpi_build_cmd() tracepoint 2021-11-18 22:26:58 -05:00
pm8001_chips.h
pm8001_ctl.c scsi: pm8001: Fix kernel-doc warnings 2021-11-29 23:02:14 -05:00
pm8001_ctl.h
pm8001_defs.h
pm8001_hwi.c scsi: pm80xx: Fix double completion for SATA devices 2022-01-31 12:14:49 -05:00
pm8001_hwi.h
pm8001_init.c Merge branch '5.16/scsi-fixes' into 5.17/scsi-staging 2021-12-16 22:38:19 -05:00
pm8001_sas.c scsi: pm8001: Fix use-after-free for aborted TMF sas_task 2022-01-31 16:40:07 -05:00
pm8001_sas.h scsi: pm80xx: Port reset timeout error handling correction 2022-01-05 00:52:48 -05:00