Skip to contentSkip to conversation

target: small fixes in pr

PATCH Applied Bodo Stroesser 3 participants 5 messages Apr 8, 2020 – Apr 13, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover target: small fixes in pr

This small series is a resend of patches that already were sent to target-devel only.

The patches fix two issues in target core pr handling.

#1 lore raw

PATCH 1/2 target: Write NULL to *port_nexus_ptr if no ISID

This patch fixes a minor flaw that could be triggered by a PR OUT RESERVE on iSCSI, if TRANSPORT IDs with and without ISID are used in the same command.
In case an ISCSI Transport ID has no ISID, port_nexus_ptr was not used to write NULL, so value from previous call might persist. I don't know, if that ever could happen, but with the change the code is cleaner, I think.

---
 drivers/target/target_core_fabric_lib.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/target/target_core_fabric_lib.c +2 -1
index 6b4b354c88aa..f5f673e128ef 100644
@@ -341,7 +341,8 @@ static char *iscsi_parse_pr_out_transport_id(
 			*p = tolower(*p);
 			p++;
 		}
-	}
+	} else
+		*port_nexus_ptr = NULL;
 
 	return &buf[4];
 }
Signature · 1 line
2.12.3
#2 lore raw

PATCH 2/2 target: fix PR IN / READ FULL STATUS for FC

In reply to Bodo Stroesser

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.

---
 drivers/target/target_core_fabric_lib.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/target/target_core_fabric_lib.c +1 -1
index f5f673e128ef..1e031d81e59e 100644
@@ -63,7 +63,7 @@ static int fc_get_pr_transport_id(
 	 * encoded TransportID.
 	 */
 	ptr = &se_nacl->initiatorname[0];
-	for (i = 0; i < 24; ) {
+	for (i = 0; i < 23; ) {
 		if (!strncmp(&ptr[i], ":", 1)) {
 			i++;
 			continue;
Signature · 1 line
2.12.3