mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
target: Don't call TFO->write_pending if data_length == 0
If an initiator sends a zero-length command (e.g. TEST UNIT READY) but sets the transfer direction in the transport layer to indicate a data-out phase, we still shouldn't try to transfer data. At best it's a NOP, and depending on the transport, we might crash on an uninitialized sg list. Reported-by: Craig Watson <[email protected]> Signed-off-by: Roland Dreier <[email protected]> Cc: <[email protected]> # 3.1 Signed-off-by: Nicholas Bellinger <[email protected]>
This commit is contained in:
parent
cac7f24298
commit
885e7b0e18
1 changed files with 1 additions and 1 deletions
|
|
@ -2292,7 +2292,7 @@ transport_generic_new_cmd(struct se_cmd *cmd)
|
|||
* and let it call back once the write buffers are ready.
|
||||
*/
|
||||
target_add_to_state_list(cmd);
|
||||
if (cmd->data_direction != DMA_TO_DEVICE) {
|
||||
if (cmd->data_direction != DMA_TO_DEVICE || cmd->data_length == 0) {
|
||||
target_execute_cmd(cmd);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue