scsi: Revert "qla2xxx: Make sure that aborted commands are freed"
authorBart Van Assche <bvanassche@acm.org>
Sat, 20 Mar 2021 23:23:53 +0000 (16:23 -0700)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 25 Mar 2021 01:45:06 +0000 (21:45 -0400)
commit39c0c8553bfb5a3d108aa47f1256076d507605e3
tree3fceff3017877963948f9b002266ddf257f022ad
parent62fc2661482b6beccfab8a5987419e96a9499fb4
scsi: Revert "qla2xxx: Make sure that aborted commands are freed"

Calling vha->hw->tgt.tgt_ops->free_cmd() from qlt_xmit_response() is wrong
since the command for which a response is sent must remain valid until the
SCSI target core calls .release_cmd(). It has been observed that the
following scenario triggers a kernel crash:

 - qlt_xmit_response() calls qlt_check_reserve_free_req()

 - qlt_check_reserve_free_req() returns -EAGAIN

 - qlt_xmit_response() calls vha->hw->tgt.tgt_ops->free_cmd(cmd)

 - transport_handle_queue_full() tries to retransmit the response

Fix this crash by reverting the patch that introduced it.

Link: https://lore.kernel.org/r/20210320232359.941-2-bvanassche@acm.org
Fixes: 0dcec41acb85 ("scsi: qla2xxx: Make sure that aborted commands are freed")
Cc: Quinn Tran <qutran@marvell.com>
Cc: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/qla2xxx/qla_target.c
drivers/scsi/qla2xxx/tcm_qla2xxx.c