Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 333050
b: refs/heads/master
c: 944981c
h: refs/heads/master
v: v3
  • Loading branch information
Nicholas Bellinger committed Oct 2, 2012
1 parent 5683daa commit c1b6f07
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 8f9f44f8957b262de717a48269a5ceca36c2b504
refs/heads/master: 944981c7e106af2aa004847e9177497856630980
21 changes: 21 additions & 0 deletions trunk/drivers/target/target_core_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -1539,6 +1539,27 @@ int target_submit_cmd_map_sgls(struct se_cmd *se_cmd, struct se_session *se_sess
if (sgl_count != 0) {
BUG_ON(!sgl);

/*
* A work-around for tcm_loop as some userspace code via
* scsi-generic do not memset their associated read buffers,
* so go ahead and do that here for type non-data CDBs. Also
* note that this is currently guaranteed to be a single SGL
* for this case by target core in target_setup_cmd_from_cdb()
* -> transport_generic_cmd_sequencer().
*/
if (!(se_cmd->se_cmd_flags & SCF_SCSI_DATA_CDB) &&
se_cmd->data_direction == DMA_FROM_DEVICE) {
unsigned char *buf = NULL;

if (sgl)
buf = kmap(sg_page(sgl)) + sgl->offset;

if (buf) {
memset(buf, 0, sgl->length);
kunmap(sg_page(sgl));
}
}

rc = transport_generic_map_mem_to_cmd(se_cmd, sgl, sgl_count,
sgl_bidi, sgl_bidi_count);
if (rc != 0) {
Expand Down

0 comments on commit c1b6f07

Please sign in to comment.