summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_lib_test.c
diff options
context:
space:
mode:
authorTony Battersby <tonyb@cybernetics.com>2025-11-10 10:59:35 -0500
committerMartin K. Petersen <martin.petersen@oracle.com>2025-11-12 18:17:28 -0500
commit3d56983cc6f03aef05ab30f8cd16039c1db3c5e0 (patch)
treeb46c11452d0cac0d95a9580a436ccfc5c2d7b405 /drivers/scsi/scsi_lib_test.c
parent5c50d84798eb2d05fa86f923ec869934d04e6f31 (diff)
scsi: qla2xxx: Fix TMR failure handling
(target mode) If handle_tmr() fails: - The code for QLA_TGT_ABTS results in memory-use-after-free and double-free: qlt_do_tmr_work() qlt_build_abts_resp_iocb() qpair->req->outstanding_cmds[h] = (srb_t *)mcmd; mempool_free(mcmd, qla_tgt_mgmt_cmd_mempool); FIRST FREE qlt_handle_abts_completion() mcmd = qlt_ctio_to_cmd() cmd = req->outstanding_cmds[h]; return cmd; vha = mcmd->vha; USE-AFTER-FREE ha->tgt.tgt_ops->free_mcmd(mcmd); SECOND FREE - qlt_send_busy() makes no sense because it sends a SCSI command response instead of a TMR response. Instead just call qlt_xmit_tm_rsp() to send a TMR failed response, since that code is well-tested and handles a number of corner cases. But it would be incorrect to call ha->tgt.tgt_ops->free_mcmd() after handle_tmr() failed, so add a flag to mcmd indicating the proper way to free the mcmd so that qlt_xmit_tm_rsp() can be used for both cases. Signed-off-by: Tony Battersby <tonyb@cybernetics.com> Link: https://patch.msgid.link/09a1ff3d-6738-4953-a31b-10e89c540462@cybernetics.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/scsi_lib_test.c')
0 files changed, 0 insertions, 0 deletions