mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-11-01 08:58:07 +00:00
4a8f71014b
The sgl is freed in the target stack in target_release_cmd_kref() before calling qlt_free_cmd() but there is an unmap of sgl in qlt_free_cmd() that causes a panic if sgl is not yet DMA unmapped: NIP dma_direct_unmap_sg+0xdc/0x180 LR dma_direct_unmap_sg+0xc8/0x180 Call Trace: ql_dbg_prefix+0x68/0xc0 [qla2xxx] (unreliable) dma_unmap_sg_attrs+0x54/0xf0 qlt_unmap_sg.part.19+0x54/0x1c0 [qla2xxx] qlt_free_cmd+0x124/0x1d0 [qla2xxx] tcm_qla2xxx_release_cmd+0x4c/0xa0 [tcm_qla2xxx] target_put_sess_cmd+0x198/0x370 [target_core_mod] transport_generic_free_cmd+0x6c/0x1b0 [target_core_mod] tcm_qla2xxx_complete_free+0x6c/0x90 [tcm_qla2xxx] The sgl may be left unmapped in error cases of response sending. For instance, qlt_rdy_to_xfer() maps sgl and exits when session is being deleted keeping the sgl mapped. This patch removes use-after-free of the sgl and ensures that the sgl is unmapped for any command that was not sent to firmware. Link: https://lore.kernel.org/r/20211018122650.11846-1-d.bogdanov@yadro.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Dmitry Bogdanov <d.bogdanov@yadro.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> |
||
---|---|---|
.. | ||
Kconfig | ||
Makefile | ||
qla_attr.c | ||
qla_bsg.c | ||
qla_bsg.h | ||
qla_dbg.c | ||
qla_dbg.h | ||
qla_def.h | ||
qla_devtbl.h | ||
qla_dfs.c | ||
qla_dsd.h | ||
qla_edif.c | ||
qla_edif.h | ||
qla_edif_bsg.h | ||
qla_fw.h | ||
qla_gbl.h | ||
qla_gs.c | ||
qla_init.c | ||
qla_inline.h | ||
qla_iocb.c | ||
qla_isr.c | ||
qla_mbx.c | ||
qla_mid.c | ||
qla_mr.c | ||
qla_mr.h | ||
qla_nvme.c | ||
qla_nvme.h | ||
qla_nx.c | ||
qla_nx.h | ||
qla_nx2.c | ||
qla_nx2.h | ||
qla_os.c | ||
qla_settings.h | ||
qla_sup.c | ||
qla_target.c | ||
qla_target.h | ||
qla_tmpl.c | ||
qla_tmpl.h | ||
qla_version.h | ||
tcm_qla2xxx.c | ||
tcm_qla2xxx.h |