This is a note to let you know that I've just added the patch titled
target: Add workaround for zero-length control CDB handling
to the 3.2-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-add-workaround-for-zero-length-control-cdb-handling.patch
and it can be found in the queue-3.2 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <[email protected]> know about it.
>From 91ec1d3535b2acf12c599045cc19ad9be3c6a47b Mon Sep 17 00:00:00 2001
From: Nicholas Bellinger <[email protected]>
Date: Fri, 13 Jan 2012 12:01:34 -0800
Subject: target: Add workaround for zero-length control CDB handling
From: Nicholas Bellinger <[email protected]>
commit 91ec1d3535b2acf12c599045cc19ad9be3c6a47b upstream.
This patch adds a work-around for handling zero allocation length
control CDBs (type SCF_SCSI_CONTROL_SG_IO_CDB) that was causing an
OOPs with the following raw calls:
# sg_raw -v /dev/sdd 3 0 0 0 0 0
# sg_raw -v /dev/sdd 0x1a 0 1 0 0 0
This patch will follow existing zero-length handling for data I/O
and silently return with GOOD status. This addresses the zero length
issue, but the proper long-term resolution for handling arbitary
allocation lengths will be to refactor out data-phase handling in
individual CDB emulation logic within target_core_cdb.c
Reported-by: Roland Dreier <[email protected]>
Signed-off-by: Nicholas Bellinger <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
drivers/target/target_core_transport.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -3701,6 +3701,11 @@ transport_allocate_control_task(struct s
struct se_task *task;
unsigned long flags;
+ /* Workaround for handling zero-length control CDBs */
+ if ((cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB) &&
+ !cmd->data_length)
+ return 0;
+
task = transport_generic_get_task(cmd, cmd->data_direction);
if (!task)
return -ENOMEM;
@@ -3772,6 +3777,14 @@ int transport_generic_new_cmd(struct se_
else if (!task_cdbs && (cmd->se_cmd_flags & SCF_SCSI_DATA_SG_IO_CDB)) {
cmd->t_state = TRANSPORT_COMPLETE;
atomic_set(&cmd->t_transport_active, 1);
+
+ if (cmd->t_task_cdb[0] == REQUEST_SENSE) {
+ u8 ua_asc = 0, ua_ascq = 0;
+
+ core_scsi3_ua_clear_for_request_sense(cmd,
+ &ua_asc, &ua_ascq);
+ }
+
INIT_WORK(&cmd->work, target_complete_ok_work);
queue_work(target_completion_wq, &cmd->work);
return 0;
Patches currently in stable-queue which might be from [email protected] are
queue-3.2/target-allow-persistent-reserve-in-for-non-reservation-holder.patch
queue-3.2/iscsi-target-fix-discovery-with-inaddr_any-and-in6addr_any_init.patch
queue-3.2/target-correct-sense-key-for-invalid-field-in-parameter-list-cdb.patch
queue-3.2/target-return-correct-asc-for-unimplemented-vpd-pages.patch
queue-3.2/iscsi-target-fix-reject-release-handling-in-iscsit_free_cmd.patch
queue-3.2/target-add-workaround-for-zero-length-control-cdb-handling.patch
queue-3.2/target-fail-inquiry-commands-with-evpd-0-but-page-code-0.patch
queue-3.2/target-use-correct-preempted-registration-sense-code.patch
queue-3.2/iscsi-target-fix-double-list_add-with-iscsit_alloc_buffs-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