summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authorAndy Grover <agrover@redhat.com>2011-07-09 02:04:53 +0200
committerNicholas Bellinger <nab@linux-iscsi.org>2011-07-22 11:37:48 +0200
commitd0229ae3fed59b4009e33f836d9ad4e312294d46 (patch)
tree148f60e1db4efa563d3f4ee5e7bc735358b57a13 /drivers/target
parenttarget: Make all control CDBs scatter-gather (diff)
downloadlinux-d0229ae3fed59b4009e33f836d9ad4e312294d46.tar.xz
linux-d0229ae3fed59b4009e33f836d9ad4e312294d46.zip
target: Enforce 1 page max for control cdb buffer sizes
Due to all cdbs' data buffers being referenced by scatterlists, buffers of more than a page are not contiguous. Instead of handling this in all control command handlers, we may be able to get away with just limiting control cdb data buffers to one page. The only control CDBs we handle that have potentially large data buffers are REPORT LUNS and UNMAP, so if we didn't want to live with this limitation, they would need to be modified to walk the pages in the data buffer's sgl. Signed-off-by: Andy Grover <agrover@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/target_core_transport.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
index c681c812dd64..267113c1607c 100644
--- a/drivers/target/target_core_transport.c
+++ b/drivers/target/target_core_transport.c
@@ -3562,6 +3562,11 @@ static int transport_generic_cmd_sequencer(
cmd->data_length = size;
}
+ /* Let's limit control cdbs to a page, for simplicity's sake. */
+ if ((cmd->se_cmd_flags & SCF_SCSI_CONTROL_SG_IO_CDB) &&
+ size > PAGE_SIZE)
+ goto out_invalid_cdb_field;
+
transport_set_supported_SAM_opcode(cmd);
return ret;