From patchwork Wed Apr 8 13:26:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bodo Stroesser X-Patchwork-Id: 11480119 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A45C21744 for ; Wed, 8 Apr 2020 13:26:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5BAB32072A for ; Wed, 8 Apr 2020 13:26:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ts.fujitsu.com header.i=@ts.fujitsu.com header.b="plaYZYxF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727928AbgDHN03 (ORCPT ); Wed, 8 Apr 2020 09:26:29 -0400 Received: from mail1.bemta26.messagelabs.com ([85.158.142.3]:46217 "EHLO mail1.bemta26.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727815AbgDHN03 (ORCPT ); Wed, 8 Apr 2020 09:26:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ts.fujitsu.com; s=200619tsfj; t=1586352387; i=@ts.fujitsu.com; bh=93ZfEJS04jwBgFKo1w/rvNzIHYLnCOqCuQQV27pOb/Y=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=plaYZYxFDhiAY/rvRCvGsGhG0XkALzaWaU1hO6QxGoj0ca6UdT+tE+Ie/ojKjvPhM AhwVUKkHbyQLiWPwgYT8Ramc98GxF7Swev4bSvUZ3d5eIMqZIXigdwEV53eDxIzTAh e7mCYDBiWPOWgKzWFY3gMADpcNx7lRiCAh4X7P5U+PsaB5MlMrZ/XahVpya0MmuAsN FTQMOBDl8qP303ZHIV/FR+bRQCH78A1ceWzeUndyYCOag947dIcUH2VRjd4RjiVM23 VPb9QlpPjCmec/H1Tfo6RImWLLo5QeeFuU9Yhw2p31SrHMtud3ipf0fUpqW+BqUnRC zOC2+t/iyJD3g== Received: from [100.113.3.6] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-3.bemta.az-a.eu-central-1.aws.symcld.net id 45/6A-36550-301DD8E5; Wed, 08 Apr 2020 13:26:27 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPLMWRWlGSWpSXmKPExsViZ8MxRZfpYm+ cwepeM4vu6zvYLJYf/8dksf7IBkaL1qVvmRxYPD4+vcXi8X7fVTaPz5vkApijWDPzkvIrElgz nu9ewV6wir1iya1ZzA2M09m6GLk4hAQmMUocn9TI0sXICeRMZ5T491oTxGYTMJBYMek+WFxEw Eai7/BSJhCbWSBdYuP6NmYQW1jAVaLh2DJWEJtFQFVizatXYDW8AnYSh2duBYtLCMhLdByYDD aHU8Be4vyVL2wQu+wkVi6/wTaBkXsBI8MqRoukosz0jJLcxMwcXUMDA11DQ2NdY10LC73EKt1 EvdRS3eTUvJKiRKCkXmJ5sV5xZW5yTopeXmrJJkZguKQUMkfsYLy29r3eIUZJDiYlUd6/J3vj hPiS8lMqMxKLM+KLSnNSiw8xynBwKEnwzrwAlBMsSk1PrUjLzAGGLkxagoNHSYRXHKSVt7ggM bc4Mx0idYpRUUqcdw1InwBIIqM0D64NFi+XGGWlhHkZGRgYhHgKUotyM0tQ5V8xinMwKgnznj gLNIUnM68EbvoroMVMQIuvJXWDLC5JREhJNTAJ+ciVeD7YpSDVZ55k9dXEm/3q3Tv/g16kyTX t5nj1USjl5B5zI/uTb38WPd+d+Up0v56H0qEPrffcS1o+ccSqVlvdPVRT0nKO78u3L0FRX/fZ fr1dVZVxlFf7p6LoqUmTJL413S/tuKM7+9bXa3aM8v2KwQtWcV+e++iOzg7v6+5zb7AflQjSk n9nf4312RJ5cbaXhcFrBDYVuWoXLzu+ialkW9Tjbc5NRS87Qz4s8L3+8tP1qttdt8Xtsp9/Lo 5ayLxSate5/raYB9v/JS113B3jbp10cvvnGes2nmuc8ukbd+DruveiWWdcT8cpWOVPnP1qytw FnrWztSOMgv/Il5x6cGQWU+2d52eOuZwqVGIpzkg01GIuKk4EAMwr1OoSAwAA X-Env-Sender: bstroesser@ts.fujitsu.com X-Msg-Ref: server-14.tower-226.messagelabs.com!1586352386!1439703!1 X-Originating-IP: [62.60.8.148] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.50.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 2519 invoked from network); 8 Apr 2020 13:26:26 -0000 Received: from unknown (HELO mailhost1.uk.fujitsu.com) (62.60.8.148) by server-14.tower-226.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Apr 2020 13:26:26 -0000 Received: from x-serv01 ([172.17.38.52]) by mailhost1.uk.fujitsu.com (8.14.5/8.14.5) with SMTP id 038DQH4l025845; Wed, 8 Apr 2020 14:26:17 +0100 Received: from VTC.emeia.fujitsu.local (unknown [172.17.38.7]) by x-serv01 (Postfix) with ESMTP id 8911C20671; Wed, 8 Apr 2020 15:26:13 +0200 (CEST) From: Bodo Stroesser To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: mchristi@redhat.com, martin.petersen@oracle.com, Bodo Stroesser Subject: [PATCH 1/2] target: Write NULL to *port_nexus_ptr if no ISID Date: Wed, 8 Apr 2020 15:26:09 +0200 Message-Id: <20200408132610.14623-2-bstroesser@ts.fujitsu.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20200408132610.14623-1-bstroesser@ts.fujitsu.com> References: <20200408132610.14623-1-bstroesser@ts.fujitsu.com> Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org 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. Signed-off-by: Bodo Stroesser --- drivers/target/target_core_fabric_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/target/target_core_fabric_lib.c b/drivers/target/target_core_fabric_lib.c index 6b4b354c88aa..f5f673e128ef 100644 --- a/drivers/target/target_core_fabric_lib.c +++ b/drivers/target/target_core_fabric_lib.c @@ -341,7 +341,8 @@ static char *iscsi_parse_pr_out_transport_id( *p = tolower(*p); p++; } - } + } else + *port_nexus_ptr = NULL; return &buf[4]; } From patchwork Wed Apr 8 13:26:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bodo Stroesser X-Patchwork-Id: 11480115 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF19292C for ; Wed, 8 Apr 2020 13:26:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9D4972072A for ; Wed, 8 Apr 2020 13:26:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=ts.fujitsu.com header.i=@ts.fujitsu.com header.b="cHq0hHnC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729128AbgDHN02 (ORCPT ); Wed, 8 Apr 2020 09:26:28 -0400 Received: from mail1.bemta26.messagelabs.com ([85.158.142.116]:34813 "EHLO mail1.bemta26.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727928AbgDHN00 (ORCPT ); Wed, 8 Apr 2020 09:26:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ts.fujitsu.com; s=200619tsfj; t=1586352382; i=@ts.fujitsu.com; bh=hj3KyWtrKww1tJ63UWW4tST618c2ILSBLf2oQGL2vxY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=cHq0hHnChdc7MauLVhuGn6Cs7oJEvWrlNBVE668DJLhXU9/m5sX1IO9cT3MySusP3 VkffPBrUwwGCCQWx+8qiJJQX1upaExr+YgcjVnkqyFfZHHjD3CIEaN5DnRowtnrtpL M6OgXcZqTLpzVzWpuxiLN9mXD85hB0XO0aJKbIvOw8BpDPGKEissDay0B3fsFj8duv NDwKofBh/nxIe/fRmCKrDVI1OcWgk0/2nI5f+hKYs6ol9ST+D1UO03XUnkrIcrPwch 0hH9IDw3TnjpkUUZuajIKQlN3Zvc2LtVWqpkJw64lGf+FLBiudMv10P7nFMzDr3dQL dBO1MiukV8XHw== Received: from [100.113.5.217] (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256 bits)) by server-5.bemta.az-b.eu-central-1.aws.symcld.net id 15/ED-46447-EF0DD8E5; Wed, 08 Apr 2020 13:26:22 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPLMWRWlGSWpSXmKPExsViZ8MRovvvQm+ cwYcDghbd13ewWSw//o/JYv2RDYwWrUvfMjmweHx8eovF4/2+q2wenzfJBTBHsWbmJeVXJLBm vP90na3gAXtFS9tGtgbGw2xdjFwcQgKTGCUOLJrIDuFMZ5R4OO84SxcjJwebgIHEikn3wWwRA RuJvsNLmUBsZoF0iY3r25hBbGEBB4nre6cDTeLgYBFQlbg9PRIkzCtgJ7H86kOwEgkBeYmOA5 PBxnAK2Eucv/KFDcQWAqpZufwG2wRG7gWMDKsYLZKKMtMzSnITM3N0DQ0MdA0NjXVNdE0t9RK rdJP0Ukt1k1PzSooSgZJ6ieXFesWVuck5KXp5qSWbGIHhklLIYr2D8fLa93qHGCU5mJREef+e 7I0T4kvKT6nMSCzOiC8qzUktPsQow8GhJME7ExiAQoJFqempFWmZOcDQhUlLcPAoifCKg7TyF hck5hZnpkOkTjEqSonzrgHpEwBJZJTmwbXB4uUSo6yUMC8jAwODEE9BalFuZgmq/CtGcQ5GJW HeE2eBpvBk5pXATX8FtJgJaPG1pG6QxSWJCCmpBibbWLPZh5/uce6tmuBzzIenMzxJwGRRzME PTqv2S90LXW7k+m31sxNN6ac0bs7f4rh230PRif66Pm7975WN3894OCFj8r99V+TMtxXUH55a PL/U5pkGR25/DfOCwxfz1rXOqMr20nkitdFg4oJn37RvOq29Uphgmqg5c1PXFmUeqUB5ybfvv GR6r6reSTnxdtLrWxPS/wgkGD+sqpsgv2yBl5vCGj69mu4L4hYV1t8y2HKyNd+f6Iv6v8jIz2 CO2aO/NzJChA5/qPmwMH7lE7+URK32D8XcJxQavLZHaC/bWz3/enlU9AvpRScNC6RvvF9W+3Z FcuaaFaJf6ho5BWzfduwydq14mb7uvErGixIlluKMREMt5qLiRABLy3qDEgMAAA== X-Env-Sender: bstroesser@ts.fujitsu.com X-Msg-Ref: server-33.tower-238.messagelabs.com!1586352381!2417026!1 X-Originating-IP: [62.60.8.84] X-SYMC-ESS-Client-Auth: outbound-route-from=pass X-StarScan-Received: X-StarScan-Version: 9.50.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 8387 invoked from network); 8 Apr 2020 13:26:22 -0000 Received: from unknown (HELO mailhost3.uk.fujitsu.com) (62.60.8.84) by server-33.tower-238.messagelabs.com with ECDHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 8 Apr 2020 13:26:22 -0000 Received: from x-serv01 ([172.17.38.52]) by mailhost3.uk.fujitsu.com (8.14.5/8.14.5) with SMTP id 038DQFvf025515; Wed, 8 Apr 2020 14:26:15 +0100 Received: from VTC.emeia.fujitsu.local (unknown [172.17.38.7]) by x-serv01 (Postfix) with ESMTP id 511ED206B2; Wed, 8 Apr 2020 15:26:14 +0200 (CEST) From: Bodo Stroesser To: linux-scsi@vger.kernel.org, target-devel@vger.kernel.org Cc: mchristi@redhat.com, martin.petersen@oracle.com, Bodo Stroesser Subject: [PATCH 2/2] target: fix PR IN / READ FULL STATUS for FC Date: Wed, 8 Apr 2020 15:26:10 +0200 Message-Id: <20200408132610.14623-3-bstroesser@ts.fujitsu.com> X-Mailer: git-send-email 2.12.3 In-Reply-To: <20200408132610.14623-1-bstroesser@ts.fujitsu.com> References: <20200408132610.14623-1-bstroesser@ts.fujitsu.com> Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org 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. Signed-off-by: Bodo Stroesser --- 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 f5f673e128ef..1e031d81e59e 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;