OSDN Git Service

scsi: target: Handle short iSIDs
authorMike Christie <michael.christie@oracle.com>
Thu, 2 Jul 2020 01:43:23 +0000 (20:43 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 8 Jul 2020 04:14:34 +0000 (00:14 -0400)
commit639341bf8836f25059f241f1e788e8cd7585ec07
treecc379a552fadfbb33f94ea22b8f94423bff21e3e
parentbd7f65d952007adceceecece39705bb3a1b55f90
scsi: target: Handle short iSIDs

SPC4 has:

The first ISCSI INITIATOR SESSION ID field byte containing an ASCII null
character terminates the ISCSI INITIATOR SESSION ID field without regard
for the specified length of the iSCSI TransportID or the contents of the
ADDITIONAL LENGTH field.
----------------------------------------

which sounds like we can get an iSID shorter than 12 chars. SPC and the
iSCSI RFC do not say how to handle that case other than just cutting off
the iSID. This patch just makes sure that if we get an iSID like that, we
only copy/send that string.

There is no OS that does this right now, so there was no test case.  I did
test with sg utils to check it works as expected and nothing breaks.

Link: https://lore.kernel.org/r/1593654203-12442-8-git-send-email-michael.christie@oracle.com
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/target/target_core_fabric_lib.c