lkml.org 
[lkml]   [2013]   [Sep]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[251/251] target: Fix trailing ASCII space usage in INQUIRY vendor+model
    3.6.11.9-rc1 stable review patch.
    If anyone has any objections, please let me know.

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

    From: Nicholas Bellinger <nab@linux-iscsi.org>

    [ Upstream commit ee60bddba5a5f23e39598195d944aa0eb2d455e5 ]

    This patch fixes spc_emulate_inquiry_std() to add trailing ASCII
    spaces for INQUIRY vendor + model fields following SPC-4 text:

    "ASCII data fields described as being left-aligned shall have any
    unused bytes at the end of the field (i.e., highest offset) and
    the unused bytes shall be filled with ASCII space characters (20h)."

    This addresses a problem with Falconstor NSS multipathing.

    Reported-by: Tomas Molota <tomas.molota@lightstorm.sk>
    Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
    ---
    drivers/target/target_core_spc.c | 9 ++++++---
    1 file changed, 6 insertions(+), 3 deletions(-)

    diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_core_spc.c
    index 6fd434d..290041b 100644
    --- a/drivers/target/target_core_spc.c
    +++ b/drivers/target/target_core_spc.c
    @@ -100,9 +100,12 @@ static int spc_emulate_inquiry_std(struct se_cmd *cmd, char *buf)

    buf[7] = 0x2; /* CmdQue=1 */

    - snprintf(&buf[8], 8, "LIO-ORG");
    - snprintf(&buf[16], 16, "%s", dev->se_sub_dev->t10_wwn.model);
    - snprintf(&buf[32], 4, "%s", dev->se_sub_dev->t10_wwn.revision);
    + memcpy(&buf[8], "LIO-ORG ", 8);
    + memset(&buf[16], 0x20, 16);
    + memcpy(&buf[16], dev->se_sub_dev->t10_wwn.model,
    + min_t(size_t, strlen(dev->se_sub_dev->t10_wwn.model), 16));
    + memcpy(&buf[32], dev->se_sub_dev->t10_wwn.revision,
    + min_t(size_t, strlen(dev->se_sub_dev->t10_wwn.revision), 4));
    buf[4] = 31; /* Set additional length to 31 */

    return 0;
    --
    1.7.10.4



    \
     
     \ /
      Last update: 2013-09-11 08:41    [W:4.663 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site