Commit fd5e7948 authored by Bodo Stroesser's avatar Bodo Stroesser Committed by Kleber Sacilotto de Souza

scsi: target: fix PR IN / READ FULL STATUS for FC

BugLink: https://bugs.launchpad.net/bugs/1878098

[ Upstream commit 8fed04eb ]

Creation of the response to READ FULL STATUS fails for FC based
reservations. Reason is the too high loop limit (< 24) in
fc_get_pr_transport_id(). The string representation of FC WWPN is 23 chars
long only ("11:22:33:44:55:66:77:88"). So when i is 23, the loop body is
executed a last time for the ending '\0' of the string and thus hex2bin()
reports an error.

Link: https://lore.kernel.org/r/20200408132610.14623-3-bstroesser@ts.fujitsu.comSigned-off-by: default avatarBodo Stroesser <bstroesser@ts.fujitsu.com>
Reviewed-by: default avatarMike Christie <mchristi@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarIan May <ian.may@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 2747d409
...@@ -75,7 +75,7 @@ static int fc_get_pr_transport_id( ...@@ -75,7 +75,7 @@ static int fc_get_pr_transport_id(
* encoded TransportID. * encoded TransportID.
*/ */
ptr = &se_nacl->initiatorname[0]; ptr = &se_nacl->initiatorname[0];
for (i = 0; i < 24; ) { for (i = 0; i < 23; ) {
if (!strncmp(&ptr[i], ":", 1)) { if (!strncmp(&ptr[i], ":", 1)) {
i++; i++;
continue; continue;
......
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