1
0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2026-01-12 01:20:14 +00:00
Tony Battersby 3d56983cc6 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>
2025-11-12 18:17:28 -05:00
..
2025-10-10 10:37:13 -07:00
2025-10-07 08:40:15 -07:00
2025-10-01 13:59:28 +02:00
2025-10-06 10:37:06 -07:00
2025-10-01 12:52:43 -07:00
2025-10-05 12:08:14 -07:00
2025-10-10 14:02:14 -07:00
2025-10-07 08:40:15 -07:00
2025-10-01 00:00:45 +00:00
2025-10-01 11:34:12 -07:00
2025-09-29 00:17:22 +02:00
2025-10-08 09:44:38 -07:00
2025-10-03 18:18:48 -07:00
2025-10-03 18:48:02 -07:00
2025-10-01 17:32:51 -07:00
2025-10-04 15:50:37 -07:00
2025-10-09 11:13:08 -07:00
2025-09-22 09:35:21 -04:00
2025-10-06 11:17:18 -07:00
2025-10-02 10:16:56 -07:00
2025-10-07 12:13:26 -07:00
2025-10-10 13:05:40 -07:00
2025-10-08 18:51:00 -07:00
2025-10-07 08:59:25 -07:00
2025-10-06 10:34:22 -07:00
2025-10-06 10:41:03 -07:00
2025-10-04 15:28:18 -07:00
2025-10-01 17:32:51 -07:00
2025-10-01 11:34:12 -07:00
2025-10-01 12:04:12 -07:00
2025-10-04 15:45:17 -07:00
2025-10-01 17:32:51 -07:00
2025-10-11 11:56:47 -07:00
2025-10-06 10:32:22 -07:00
2025-10-01 17:32:51 -07:00
2025-10-07 11:41:06 -07:00
2025-10-11 11:49:00 -07:00
2025-10-01 17:32:51 -07:00
2025-10-07 11:36:01 -07:00
2025-10-11 11:49:00 -07:00
2025-10-07 08:40:15 -07:00
2025-10-04 16:07:08 -07:00
2025-10-01 07:24:43 -04:00
2025-09-29 18:48:39 -07:00
2025-10-04 08:48:16 -07:00
2025-10-06 11:00:30 -07:00
2025-10-03 17:41:12 -07:00
2025-10-07 08:40:15 -07:00