Commit 721ab147 authored by Nicholas Bellinger's avatar Nicholas Bellinger Committed by Ben Hutchings

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

commit ee60bddb 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: default avatarTomas Molota <tomas.molota@lightstorm.sk>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
[bwh: Backported to 3.2, based on Nicholas's versions for 3.0 and 3.4]
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent 9f9c4293
......@@ -127,11 +127,12 @@ target_emulate_inquiry_std(struct se_cmd *cmd)
goto out;
}
snprintf((unsigned char *)&buf[8], 8, "LIO-ORG");
snprintf((unsigned char *)&buf[16], 16, "%s",
&dev->se_sub_dev->t10_wwn.model[0]);
snprintf((unsigned char *)&buf[32], 4, "%s",
&dev->se_sub_dev->t10_wwn.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 */
out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment