Patch "target: Fix caw_sem leak in transport_generic_request_failure" has been added to the 4.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
target: Fix caw_sem leak in transport_generic_request_failure
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
target-fix-caw_sem-leak-in-transport_generic_request_failure.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
fd2f928b0ddd2fe8876d4f1344df2ace2b715a4dMon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Fri, 29 Sep 2017 16:03:24 -0700
Subject: target: Fix caw_sem leak in transport_generic_request_failure
From: Nicholas Bellinger <[email protected]>
commit fd2f928b0ddd2fe8876d4f1344df2ace2b715a4d upstream.
With the recent addition of transport_check_aborted_status() within transport_generic_request_failure() to avoid sending a SCSI status exception after CMD_T_ABORTED w/ TAS=1 has occured, it introduced a COMPARE_AND_WRITE early failure regression.
Namely when COMPARE_AND_WRITE fails and se_device->caw_sem has been taken by sbc_compare_and_write(), if the new check for transport_check_aborted_status() returns true and exits, cmd->transport_complete_callback() -> compare_and_write_post() is skipped never releasing se_device->caw_sem.
This regression was originally introduced by:
commit e3b88ee95b4e4bf3e9729a4695d695b9c7c296c8
Author: Bart Van Assche <[email protected]>
Date: Tue Feb 14 16:25:45 2017 -0800
target: Fix handling of aborted failed commands
To address this bug, move the transport_check_aborted_status() call after transport_complete_task_attr() and cmd->transport_complete_callback().
--- drivers/target/target_core_transport.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/target/target_core_transport.c +4 -3
@@ -1730,9 +1730,6 @@ void transport_generic_request_failure(s {int ret =0 , post_ret =0 ; -if (transport_check_aborted_status (cmd,1 )) -return ; -pr_debug ("-----[ Storage Engine Exception; sense_reason %d\n" , sense_reason);target_show_cmd ("-----[ " , cmd);
@@ -1741,6 +1738,7 @@ void transport_generic_request_failure(s* For SAM Task Attribute emulation for failed struct se_cmd */ transport_complete_task_attr (cmd); +/* * Handle special case for COMPARE_AND_WRITE failure, where the * callback is expected to drop the per device ->caw_sem.
@@ -1749,6 +1747,9 @@ void transport_generic_request_failure(s cmd->transport_complete_callback) cmd->transport_complete_callback (cmd, false, &post_ret); +if (transport_check_aborted_status (cmd,1 )) +return ; +switch (sense_reason) {case TCM_NON_EXISTENT_LUN :case TCM_UNSUPPORTED_SCSI_OPCODE :
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/target-fix-null-pointer-regression-in-core_tmr_drain_tmr_list.patch queue-4.14/iscsi-target-make-task_reassign-use-proper-se_cmd-cmd_kref.patch queue-4.14/target-fix-queue_full-scsi-task-attribute-handling.patch queue-4.14/target-fix-buffer-offset-in-core_scsi3_pri_read_full_status.patch queue-4.14/iscsi-target-fix-non-immediate-tmr-reference-leak.patch queue-4.14/target-fix-caw_sem-leak-in-transport_generic_request_failure.patch queue-4.14/target-avoid-early-cmd_t_pre_execute-failures-during-abort_task.patch queue-4.14/target-fix-quiese-during-transport_write_pending_qf-endless-loop.patch