Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp558428ybz; Fri, 24 Apr 2020 05:24:58 -0700 (PDT) X-Google-Smtp-Source: APiQypJy1Q4p/NItm5CWeFiq7HQIN4HYhnlZaGTG/0IlJoKYJnRciDbnCwhjEdW8Y8RfUsz7UhVs X-Received: by 2002:a17:907:41b6:: with SMTP id na6mr6714162ejb.119.1587731098588; Fri, 24 Apr 2020 05:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587731098; cv=none; d=google.com; s=arc-20160816; b=OkVpVwY5GjhHhbdQ91JG5xjLa4pOtaHxPw3xOIqy9uQTJGNNLl6hGz3W1Q7CW6dw3p 27ssg1OBx2tk4n7dKfWq0fqqZpgUfvRYQXUd7rEcRQAXmKX/ipc3X9sSjX4D4dOi80GX +TjVL8xZoacxxh2IFjHn8Gpn+Obm0/BdUHkXgXFnDdUh3zR+sVlHQDSsSKWtlPwSfK33 dLNKampOH5+9OrxnLoobdgxEkCcp0uDenGuC/IU172ckJW75GnGVLwdbCsmXV42etHH1 /cAafycKvT2UbVwV0ycrV1SqgX/Ig8ktHsCVRq7bTSdC+d+wU5loU+v2CINYpQtLDHnU AMHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ezSH3nOBZjG/UfQ4WLY2DxPyDR0lvvNWzK2wKy768bI=; b=I5IC8w0cCvlU45fix4fqTC7Voa1/SYpWUoqURrRi0eSJT+lRvmdCQmCrTkg2Woyoip SzPV0F5rT2YbfLLzHYjy45iqd6ELn0cAr4MWeR7aS4A6+p2I2h82CzFY/OrhwB0E//Uo ASy73/DWIyZNh80nxeYjemluNgks4i7tEawsOkX3p0lKHOemMfMlrn7ao6+4KeMHNapX u1j3ftnbjyPQQ3W1ozWIXxR1I/LPzsELabIP/Yye6cVUmp7rW/C6C4pLA86Y11DZhtU8 DW96xW51clBPTlJeqiONbpXbEL0DfPGt3cLbUEo/5zftM056db46MtMoqjTFCjdfmbhK QuxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0OsikzGO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a22si3244539edn.385.2020.04.24.05.24.35; Fri, 24 Apr 2020 05:24:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=0OsikzGO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727784AbgDXMXA (ORCPT + 99 others); Fri, 24 Apr 2020 08:23:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:52228 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727106AbgDXMWz (ORCPT ); Fri, 24 Apr 2020 08:22:55 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C92D621655; Fri, 24 Apr 2020 12:22:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587730974; bh=0q/xyRhBBkaXhh1rqSS+bdiBtGSIXDcfrgR5fSDD1xA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=0OsikzGO61oUADvfmCTQQY+DSUkCvyqJAJCD22ANpSYsnaB1GDl2O8hKWc02BAVfj p605JAgFTQ7WLoZ0fIhhHhEPbZ74ADWz6fkOmtNxZjOQK3+AIIlt10g3QsXqcx6tqu w+dLFWZrkLh1pyDZLHUwpg7PkPavB6XbCMODdMbU= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bodo Stroesser , Mike Christie , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Subject: [PATCH AUTOSEL 5.6 15/38] scsi: target: fix PR IN / READ FULL STATUS for FC Date: Fri, 24 Apr 2020 08:22:13 -0400 Message-Id: <20200424122237.9831-15-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200424122237.9831-1-sashal@kernel.org> References: <20200424122237.9831-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bodo Stroesser [ Upstream commit 8fed04eb79a74cbf471dfaa755900a51b37273ab ] 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.com Signed-off-by: Bodo Stroesser Reviewed-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/target/target_core_fabric_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c index 6b4b354c88aa0..b5c970faf5854 100644 --- a/drivers/target/target_core_fabric_lib.c +++ b/drivers/target/target_core_fabric_lib.c @@ -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; -- 2.20.1