This is a note to let you know that I've just added the patch titled

    target: Fix se_cmd->state_list leak regression during WRITE failure

to the 3.11-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-se_cmd-state_list-leak-regression-during-write-failure.patch
and it can be found in the queue-3.11 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.


>From c130480b129fbfd7932ad7af3f4ffcea630b027f Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Sat, 31 Aug 2013 15:12:01 -0700
Subject: target: Fix se_cmd->state_list leak regression during WRITE failure

From: Nicholas Bellinger <[email protected]>

commit c130480b129fbfd7932ad7af3f4ffcea630b027f upstream.

This patch addresses a v3.11 specific regression where se_cmd->state_list
was being leaked during a fabric WRITE failure, when the fabric releases
an associated se_cmd descriptor before I/O submission occurs, and normal
fast path callbacks have a chance to call target_remove_from_state_list().

It was manifesting with Poison overwritten messages with iscsi-target
once an ImmediateData payload CRC32C failure occured.

This bug was originally introduced during v3.11-rc1 with the following
commit:

commit 0b66818ac6de67a6125ae203272fb76e79b3a20f
Author: Nicholas Bellinger <[email protected]>
Date:   Thu Jun 6 01:36:41 2013 -0700

    target: Drop unnecessary CMD_T_DEV_ACTIVE check from 
transport_lun_remove_cmd

Signed-off-by: Nicholas Bellinger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/target/target_core_transport.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -2134,6 +2134,7 @@ static void transport_write_pending_qf(s
 
 int transport_generic_free_cmd(struct se_cmd *cmd, int wait_for_tasks)
 {
+       unsigned long flags;
        int ret = 0;
 
        if (!(cmd->se_cmd_flags & SCF_SE_LUN_CMD)) {
@@ -2144,6 +2145,16 @@ int transport_generic_free_cmd(struct se
        } else {
                if (wait_for_tasks)
                        transport_wait_for_tasks(cmd);
+               /*
+                * Handle WRITE failure case where transport_generic_new_cmd()
+                * has already added se_cmd to state_list, but fabric has
+                * failed command before I/O submission.
+                */
+               if (cmd->state_active) {
+                       spin_lock_irqsave(&cmd->t_state_lock, flags);
+                       target_remove_from_state_list(cmd);
+                       spin_unlock_irqrestore(&cmd->t_state_lock, flags);
+               }
 
                if (cmd->se_lun)
                        transport_lun_remove_cmd(cmd);


Patches currently in stable-queue which might be from [email protected] are

queue-3.11/target-fix-trailing-ascii-space-usage-in-inquiry-vendor-model.patch
queue-3.11/iscsi-target-fix-iscsit_transport-reference-leak-during-np-thread-reset.patch
queue-3.11/target-fix-se_cmd-state_list-leak-regression-during-write-failure.patch
queue-3.11/iscsi-target-fix-immediatedata-yes-failure-regression-in-v3.10.patch
queue-3.11/iscsi-target-fix-potential-null-pointer-in-solicited-nopout-reject.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to