Skip to content

Commit

Permalink
target: Fix trailing ASCII space usage in INQUIRY vendor+model
Browse files Browse the repository at this point in the history
commit ee60bdd upstream.

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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Nicholas Bellinger authored and Greg Kroah-Hartman committed Sep 8, 2013
1 parent 833c9b8 commit e9d581e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions drivers/target/target_core_cdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,12 @@ target_emulate_inquiry_std(struct se_cmd *cmd)
return 0;
}

snprintf((unsigned char *)&buf[8], 8, "LIO-ORG");
snprintf((unsigned char *)&buf[16], 16, "%s",
&DEV_T10_WWN(dev)->model[0]);
snprintf((unsigned char *)&buf[32], 4, "%s",
&DEV_T10_WWN(dev)->revision[0]);
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;
}
Expand Down

0 comments on commit e9d581e

Please sign in to comment.