Commit 3d56983
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>1 parent 5c50d84 commit 3d56983
3 files changed
Lines changed: 27 additions & 33 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1893 | 1893 | | |
1894 | 1894 | | |
1895 | 1895 | | |
1896 | | - | |
| 1896 | + | |
1897 | 1897 | | |
1898 | 1898 | | |
1899 | 1899 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2005 | 2005 | | |
2006 | 2006 | | |
2007 | 2007 | | |
2008 | | - | |
2009 | 2008 | | |
2010 | 2009 | | |
2011 | 2010 | | |
| |||
2020 | 2019 | | |
2021 | 2020 | | |
2022 | 2021 | | |
2023 | | - | |
2024 | | - | |
2025 | | - | |
2026 | | - | |
2027 | | - | |
2028 | | - | |
2029 | | - | |
2030 | | - | |
2031 | | - | |
2032 | | - | |
2033 | | - | |
2034 | | - | |
2035 | | - | |
2036 | | - | |
2037 | | - | |
2038 | | - | |
2039 | | - | |
2040 | | - | |
2041 | | - | |
2042 | | - | |
2043 | | - | |
2044 | | - | |
2045 | | - | |
2046 | | - | |
2047 | 2022 | | |
2048 | 2023 | | |
2049 | 2024 | | |
2050 | | - | |
| 2025 | + | |
| 2026 | + | |
| 2027 | + | |
2051 | 2028 | | |
2052 | 2029 | | |
2053 | 2030 | | |
| |||
2234 | 2211 | | |
2235 | 2212 | | |
2236 | 2213 | | |
| 2214 | + | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
| 2219 | + | |
| 2220 | + | |
| 2221 | + | |
| 2222 | + | |
| 2223 | + | |
| 2224 | + | |
| 2225 | + | |
| 2226 | + | |
| 2227 | + | |
| 2228 | + | |
2237 | 2229 | | |
2238 | 2230 | | |
2239 | 2231 | | |
| |||
2326 | 2318 | | |
2327 | 2319 | | |
2328 | 2320 | | |
2329 | | - | |
| 2321 | + | |
2330 | 2322 | | |
2331 | 2323 | | |
2332 | 2324 | | |
2333 | 2325 | | |
2334 | | - | |
| 2326 | + | |
2335 | 2327 | | |
2336 | 2328 | | |
2337 | 2329 | | |
| |||
2364 | 2356 | | |
2365 | 2357 | | |
2366 | 2358 | | |
2367 | | - | |
| 2359 | + | |
2368 | 2360 | | |
2369 | 2361 | | |
2370 | 2362 | | |
| |||
5742 | 5734 | | |
5743 | 5735 | | |
5744 | 5736 | | |
5745 | | - | |
| 5737 | + | |
5746 | 5738 | | |
5747 | 5739 | | |
5748 | 5740 | | |
| |||
5753 | 5745 | | |
5754 | 5746 | | |
5755 | 5747 | | |
5756 | | - | |
| 5748 | + | |
5757 | 5749 | | |
5758 | 5750 | | |
5759 | | - | |
| 5751 | + | |
5760 | 5752 | | |
5761 | 5753 | | |
5762 | 5754 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
966 | 966 | | |
967 | 967 | | |
968 | 968 | | |
| 969 | + | |
969 | 970 | | |
970 | 971 | | |
971 | 972 | | |
| |||
1059 | 1060 | | |
1060 | 1061 | | |
1061 | 1062 | | |
| 1063 | + | |
1062 | 1064 | | |
1063 | 1065 | | |
1064 | 1066 | | |
| |||
0 commit comments