lkml.org 
[lkml]   [2014]   [Dec]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 3.13.y-ckt 090/121] target: Don't call TFO->write_pending if data_length == 0
    Date
    3.13.11-ckt12 -stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Roland Dreier <roland@purestorage.com>

    commit 885e7b0e181c14e4d0ddd26c688bad2b84c1ada9 upstream.

    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 <craig.watson@vanguard-rugged.com>
    Signed-off-by: Roland Dreier <roland@purestorage.com>
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Kamal Mostafa <kamal@canonical.com>
    ---
    drivers/target/target_core_transport.c | 2 +-
    1 file changed, 1 insertion(+), 1 deletion(-)

    diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c
    index 3acb125..40f171b 100644
    --- a/drivers/target/target_core_transport.c
    +++ b/drivers/target/target_core_transport.c
    @@ -2192,7 +2192,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;
    }
    --
    1.9.1


    \
     
     \ /
      Last update: 2014-12-02 21:21    [W:4.583 / U:0.128 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site