Skip to content

Commit

Permalink
target: Enforce 1 page max for control cdb buffer sizes
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Andy Grover authored and Nicholas Bellinger committed Jul 22, 2011
1 parent 05d1c7c commit d0229ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
1 change: 1 addition & 0 deletions include/target/target_core_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
/* Used by transport_generic_allocate_iovecs() */
#define TRANSPORT_IOV_DATA_BUFFER 5
/* Maximum Number of LUNs per Target Portal Group */
/* Don't raise above 511 or REPORT_LUNS needs to handle >1 page */
#define TRANSPORT_MAX_LUNS_PER_TPG 256
/*
* By default we use 32-byte CDBs in TCM Core and subsystem plugin code.
Expand Down

0 comments on commit d0229ae

Please sign in to comment.