Commit ee60bddba5a5f23e39598195d944aa0eb2d455e5

Authored by Nicholas Bellinger
1 parent d4e4ab86bc

target: Fix trailing ASCII space usage in INQUIRY vendor+model

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>

Showing 1 changed file with 6 additions and 3 deletions Side-by-side Diff

drivers/target/target_core_spc.c
... ... @@ -97,9 +97,12 @@
97 97  
98 98 buf[7] = 0x2; /* CmdQue=1 */
99 99  
100   - snprintf(&buf[8], 8, "LIO-ORG");
101   - snprintf(&buf[16], 16, "%s", dev->t10_wwn.model);
102   - snprintf(&buf[32], 4, "%s", dev->t10_wwn.revision);
  100 + memcpy(&buf[8], "LIO-ORG ", 8);
  101 + memset(&buf[16], 0x20, 16);
  102 + memcpy(&buf[16], dev->t10_wwn.model,
  103 + min_t(size_t, strlen(dev->t10_wwn.model), 16));
  104 + memcpy(&buf[32], dev->t10_wwn.revision,
  105 + min_t(size_t, strlen(dev->t10_wwn.revision), 4));
103 106 buf[4] = 31; /* Set additional length to 31 */
104 107  
105 108 return 0;