From patchwork Thu Jul 27 13:47:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark O'Donovan X-Patchwork-Id: 127009 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1174614vqo; Thu, 27 Jul 2023 08:19:47 -0700 (PDT) X-Google-Smtp-Source: APBJJlF8RflY/gf/pjPp+eAkINBBCqc6obxQ3fDdMDF3Oo5WtMyMx8KpjO4ncneGrjeyrTO5KXZD X-Received: by 2002:a17:90a:c252:b0:268:39d6:3a1e with SMTP id d18-20020a17090ac25200b0026839d63a1emr4061038pjx.14.1690471187310; Thu, 27 Jul 2023 08:19:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690471187; cv=none; d=google.com; s=arc-20160816; b=UzCSv3Qf8+YYJIR/8BfFXmecdrPZH72znNEQTpsEy3Fd2aFblJkQvf6s05SfQvgybx ErKKFTxOSN91RUpRyBE/PSU0bwiXtxW1XN//DeXi8Feps+NgMTuL5Ws0N5fZ3K719tpL 1cQwF5dVqIk9ROKgwzUiVZqXBKvON4ULNZDNpl5p6SFxFQ30aCrYWsFSB3VpRegRKrBc OLfDNJguk3y9emiE7NfR/nTioIy5ghdQNGJCj6Z2ePG2mizw4Mt1caFPnejWFWLQ/IZE hRta9R64DtbLmnz2EG60om4eTBucATAA82guj9nbEPmpLeWjUxoQkBo6pCeX5Iu779la hFSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wJHPqyoHtiQksRg5iRHZydgfRAjfBsbfV0NVzNon1EE=; fh=hQrnR+dWZ1M7Kv0LlLHAp3Kk3ye8WfN0n9TPb3Q2SOI=; b=toOa9TYhuEbkmVBNjBDVr+JzTdweMDkAi3YvgmRfj6Uwtq3mnChdZSCEp5mZLPqM/W QfZmPb3z7/pTS7+KZI4YX6qA9aqjqwdn2n2qkVa/3IeWQPxlc8s4gha/3OqEJ83ECgy+ GG0cyDmQjorBoSvENukpmVp3XpbCzRIwXP1SQED4OC4IFH2A7eeu9mhwaYIRX/9CxKM0 wXOCOm3V9caMF7PQ1AWlkNXQYsYUlTqu5QSvdESrt4ZgoqKWQCcJOqY+uWL4OIZmHfyw QbAglANFiW/qEJKd3Sc+vqQzGKeG3y2htjHhLCt9e5Uf+rhYkpIDVBkfhCIgPwnxMg9Q hX+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=WKTdjewt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nh10-20020a17090b364a00b00259b2afc651si2900811pjb.62.2023.07.27.08.19.33; Thu, 27 Jul 2023 08:19:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=WKTdjewt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232910AbjG0N6R (ORCPT + 99 others); Thu, 27 Jul 2023 09:58:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231235AbjG0N6O (ORCPT ); Thu, 27 Jul 2023 09:58:14 -0400 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0F02E64 for ; Thu, 27 Jul 2023 06:58:10 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id A5237240104 for ; Thu, 27 Jul 2023 15:58:07 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1690466287; bh=AQUkhOUuCll+t4Bc33a3LEsUOgQSYv/ROCYEwaxRzJg=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=WKTdjewtQYewNsFbPNhts/D5Lcwq2i5C5lR00wPqQqI1BmHAYrpoeamviQ+DEPKpo 1lPGZ1JTnwMrUxT1UvKfSY+QxicKoDMU3IHFWSChTp7Fnxt32M9lBdmhwKs1Z2M5x0 PrEA5QFX+NQGA90Z1Xg5hdce5jbI4M5qxYLo83S5Mzdb9k8eQhQIT001LVMrBf1FiY UMeNcGJ9FYb4RB37GzRxv6/mgtCZwd0cy/rmDz/y/6aTLhqaHIK/gNLHr7QbLwTa+L L5IbASTn2m8rCrxuLPJaddU59y6PuK3CvaKCBqEugcLRI5794sRzHxKmnEUDi+b6+h Wp+SvSxEaldVw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RBXR15gqpz6tsb; Thu, 27 Jul 2023 15:58:05 +0200 (CEST) From: Mark O'Donovan To: linux-kernel@vger.kernel.org Cc: linux-nvme@lists.infradead.org, sagi@grimberg.me, hch@lst.de, axboe@kernel.dk, kbusch@kernel.org, hare@suse.de, Mark O'Donovan Subject: [PATCH 1/2] nvme-auth: unlock mutex in one place only Date: Thu, 27 Jul 2023 13:47:47 +0000 Message-Id: <20230727134748.4163796-1-shiftee@posteo.net> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772587515749022644 X-GMAIL-MSGID: 1772587515749022644 Signed-off-by: Mark O'Donovan Reviewed-by: Christoph Hellwig Reviewed-by: Sagi Grimberg --- drivers/nvme/host/auth.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c index daf5d144a8ea..e1a98647c3a2 100644 --- a/drivers/nvme/host/auth.c +++ b/drivers/nvme/host/auth.c @@ -758,12 +758,11 @@ static void nvme_queue_auth_work(struct work_struct *work) __func__, chap->qid); mutex_lock(&ctrl->dhchap_auth_mutex); ret = nvme_auth_dhchap_setup_host_response(ctrl, chap); + mutex_unlock(&ctrl->dhchap_auth_mutex); if (ret) { - mutex_unlock(&ctrl->dhchap_auth_mutex); chap->error = ret; goto fail2; } - mutex_unlock(&ctrl->dhchap_auth_mutex); /* DH-HMAC-CHAP Step 3: send reply */ dev_dbg(ctrl->device, "%s: qid %d send reply\n", From patchwork Thu Jul 27 13:47:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark O'Donovan X-Patchwork-Id: 126986 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a985:0:b0:3e4:2afc:c1 with SMTP id t5csp1128405vqo; Thu, 27 Jul 2023 07:11:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlEITj8dXustSaA0KvfJ+I9+leNw19YEIueojdLhaqKxzdfg9N4vwIQ0PZP5ckiN3qd5lv6E X-Received: by 2002:a17:903:11d1:b0:1b7:c166:f197 with SMTP id q17-20020a17090311d100b001b7c166f197mr5330009plh.29.1690467072163; Thu, 27 Jul 2023 07:11:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690467072; cv=none; d=google.com; s=arc-20160816; b=beTcLciwD8pB+mI9xNBIwyZuijOF5nj2Ibz5FonJTNn/UUDoQu6qfCcaG/7bZjaLxg BljQbnnv3lNgedYQPkEhGBokYso3CrqyP1gQTnt/u8/OQUqdXuiOGfoMf+r74Ll+tXx9 LF3kxOHbuh8vxO0r1sTRDDCkMCg2usRkBrXWKGq3jhhBI+rNqb2LczaXAQ2QooSM28Nq jc9dHGHw832GyFSs+dKkuNjGehuIo/cLee52UMKMRRFDd2qZZVhzeGTvmM2ZJ/jwhvB1 9Fmlgq2PFoEGF4t0Qr5UptuGbDA9blCiLvF2wpw3sKe7ATUZFcZbbWTbJazzklbrOZUt zrkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=a3JqXahHu0shDXE+GkcO+YOLNEhc9HOLT6Dsw+IT9us=; fh=hQrnR+dWZ1M7Kv0LlLHAp3Kk3ye8WfN0n9TPb3Q2SOI=; b=RgEO3R2Ta1M4zmYPXJMTooJcJTUTgpTpOFOMDauEEAAwppJcQzEba+9xKv7tYgakhZ U9JjtysF9+CuPualXM7EN6A/lvNYdHrXsDifX2b6/f/IsAtRmaczP/K+WXUK8eTN5GJ5 dNnT6p/qmT+NfHL86N0z6IW8qIqA5XIiTBa9RG/tJG1QJ8gpjc8XGAdFhnHWefbibtbm 3fjNkh8vMDe19siWyaV8uzfO7McGi+dEj+HtkhrKzVeoEwvG4TjCupfZQyg/VGHF1hSW +XRqhG7jY805OjHjCGfGe+A3R01Qh7nn2Fa0ZZt1UR6jqHG03Uv0UuzqkM0U7C3PycI9 cFXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b="b/P7e0fU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id kt13-20020a170903088d00b001b9e66e836dsi1270825plb.587.2023.07.27.07.10.57; Thu, 27 Jul 2023 07:11:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b="b/P7e0fU"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=posteo.net Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233345AbjG0N6P (ORCPT + 99 others); Thu, 27 Jul 2023 09:58:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231773AbjG0N6O (ORCPT ); Thu, 27 Jul 2023 09:58:14 -0400 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0E41E62 for ; Thu, 27 Jul 2023 06:58:10 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 85662240101 for ; Thu, 27 Jul 2023 15:58:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1690466288; bh=wuGCYUOgNBYqBLJZagw6Q9jgYZ2fW49Hn985P9qL1/U=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=b/P7e0fUhM8lxcyY1nCPo6RL3aYe0Xd4s8qUtZonsbL/K2JxiUxyWrp0iKDDA4ozw 6ylTysHxfa/aM3cjW+Seh+B3TLT32VbgEtlZEHCEtqwTztNGCJzkXRSVg0iHVQGkQp /1OipYVyiYtVVOR1frMEIq06XdL+lqHfXDJhnP2wneuFho5mYo40ohe2k0YStF/Pee A1N0zVb5NuH/HtcKWe2B+7YUW63Tg34HFRbSLSJIu8yILlyCJ54A2epLduz5rOOLVT 9tj0e5ZpetiiiBeJ+IEDmyr6eHR4+id3ExmWuEY/DTUslqdGtHg+3A/TMr0XD6yCvY H7Ud2fQxKu5Ig== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RBXR31sK4z6txb; Thu, 27 Jul 2023 15:58:07 +0200 (CEST) From: Mark O'Donovan To: linux-kernel@vger.kernel.org Cc: linux-nvme@lists.infradead.org, sagi@grimberg.me, hch@lst.de, axboe@kernel.dk, kbusch@kernel.org, hare@suse.de, Mark O'Donovan Subject: [PATCH 2/2] nvme-auth: set explanation code for failure2 msgs Date: Thu, 27 Jul 2023 13:47:48 +0000 Message-Id: <20230727134748.4163796-2-shiftee@posteo.net> In-Reply-To: <20230727134748.4163796-1-shiftee@posteo.net> References: <20230727134748.4163796-1-shiftee@posteo.net> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772583200931768381 X-GMAIL-MSGID: 1772583200931768381 These error cases were not setting an auth-failure-reason-code-explanation. This means an AUTH_Failure2 message will be sent with an explanation value of 0 which is a reserved value. Signed-off-by: Mark O'Donovan --- drivers/nvme/host/auth.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c index e1a98647c3a2..094f37e11921 100644 --- a/drivers/nvme/host/auth.c +++ b/drivers/nvme/host/auth.c @@ -760,6 +760,7 @@ static void nvme_queue_auth_work(struct work_struct *work) ret = nvme_auth_dhchap_setup_host_response(ctrl, chap); mutex_unlock(&ctrl->dhchap_auth_mutex); if (ret) { + chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; chap->error = ret; goto fail2; } @@ -776,6 +777,7 @@ static void nvme_queue_auth_work(struct work_struct *work) tl = ret; ret = nvme_auth_submit(ctrl, chap->qid, chap->buf, tl, true); if (ret) { + chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; chap->error = ret; goto fail2; } @@ -811,6 +813,7 @@ static void nvme_queue_auth_work(struct work_struct *work) ret = nvme_auth_dhchap_setup_ctrl_response(ctrl, chap); if (ret) { mutex_unlock(&ctrl->dhchap_auth_mutex); + chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; chap->error = ret; goto fail2; } @@ -830,8 +833,10 @@ static void nvme_queue_auth_work(struct work_struct *work) __func__, chap->qid); tl = nvme_auth_set_dhchap_success2_data(ctrl, chap); ret = nvme_auth_submit(ctrl, chap->qid, chap->buf, tl, true); - if (ret) + if (ret) { + chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; chap->error = ret; + } } if (!ret) { chap->error = 0;