From patchwork Mon Jul 31 14:51:05 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: 128789 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2145794vqg; Mon, 31 Jul 2023 10:04:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlEr7XmidW1fEhbnVlZbOobMIgjdaPmg3TcQNvPWgzUMEme8PngqX9KbTBu6J6IujBKwG0gv X-Received: by 2002:aa7:df02:0:b0:51e:2282:e1fc with SMTP id c2-20020aa7df02000000b0051e2282e1fcmr403095edy.6.1690823090146; Mon, 31 Jul 2023 10:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690823090; cv=none; d=google.com; s=arc-20160816; b=sCltwTkE2KkwT8Xq5esfYhI7GQQRqFxNChNJGVAA18DjIU6yTFD7c7RjncSYT62yKK RhoOex9Slhc6mAq0aQP8UlBSKpeIBKTQBBr4kSMBs3Wmampaj3fQMGaVX7H7bUyQ+CRu CdVkPdrLR/ekqoPAEfIPSJwCU8kvdVJXS7DzZCmiNw2UnzjPZHNyT+vmrPh0M50RfftJ ya4tN4HK7ZQO5HVWQy3TDtNXMwGvlZnIkI+ISQ45HzvgAHXbdLqy5Ynzi41cjg8Ks4FN IP/vHN0kV3qA5uXTZ0EtR4kU90eN94up/IABfYSwcmwVpBZdcyL60DcRxvysK6+T4rDd FZdw== 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=z9mrYk9ezevgnVRh6fo8v+zzdhxngLuWQKAfOQIGxIk=; fh=OWp1JE7RoKE/G7JKZdGUrLBi8WjeFKNi5RN//eKMHcA=; b=xhcYgAfMTsSKpdM612+gbXHUQEytEn+T31yYbgHB8EWGL2ZOero0nsvEFFSCG3+Lms 7Hv3Z+sWLE3Ye+NcOEnt8Z0m7p372680lKmWv9iC1OKvlMykes7tOLY4acbxZbTczp3U 7GfMlPb8nfGldvy+QeXkSE5+dBsc7QnE7mGkUIddRJ2ESLj6aN2qc3pBjsyxM6Kmrj/s 2/yyRnEycfgtpjf/ZT0gwPk2oUp8jzxokovI0JBlCjoQAsNbs2FhUrfbYZTXrMOt8onb +0am6NkGtrqaDNXmsZpHdIyj0GSXD7o+nlZXx93aZ73/EoOSer0vbt9CC6Hz36O+8PeX oyHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=izyE3ONG; 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 p25-20020a056402075900b0052278a08504si3094474edy.485.2023.07.31.10.04.17; Mon, 31 Jul 2023 10:04:50 -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=izyE3ONG; 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 S230266AbjGaPAo (ORCPT + 99 others); Mon, 31 Jul 2023 11:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229955AbjGaPAn (ORCPT ); Mon, 31 Jul 2023 11:00:43 -0400 Received: from mout01.posteo.de (mout01.posteo.de [185.67.36.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E13A3E78 for ; Mon, 31 Jul 2023 08:00:39 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id A06AE240029 for ; Mon, 31 Jul 2023 17:00:37 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1690815637; bh=XImkWyr8X4KhNLsQctrbLiFktbFlqmuLxa0+EGeRPJA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=izyE3ONGaA+0jfWhgRU//8h85d0ObOdP7jK5FSSx3X2DTKilXfgsxG5TKQn0jbw5n LgEheEDXQlvdZBXqmxPJEv+C7Osk4ItDJu7cJz3+g844hRbLemMkcU+O06ugrIbupa 9PS7mvZ5yrDb05/OlJxf6zQDyA0+PEzjRZce2zjgLpYJJC9TfUMWbb7zl2ONGoaV6t 9JdqfLFyUP0H4NVNygbi270PXhv7S9HLAiFKAn4QKKyvaD1NP5rFPqRsoiTuycyNTz y1HyY9x/JB1bFtI+znYZjYkBW1YUP3FqgS2GJ2P7U93sNfVsWlyHLcMAtSLic+VhqL 49PMktOwVpYWw== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RF1dH2n7bz9s0p; Mon, 31 Jul 2023 17:00:35 +0200 (CEST) From: Mark O'Donovan To: linux-kernel@vger.kernel.org Cc: linux-nvme@lists.infradead.org, axboe@kernel.dk, kbusch@kernel.org, hare@suse.de, Mark O'Donovan , Christoph Hellwig , Sagi Grimberg Subject: [PATCH v2 1/2] nvme-auth: unlock mutex in one place only Date: Mon, 31 Jul 2023 14:51:05 +0000 Message-Id: <20230731145106.917526-1-shiftee@posteo.net> MIME-Version: 1.0 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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: 1772956133760603133 X-GMAIL-MSGID: 1772956512542562178 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 Mon Jul 31 14:51:06 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: 128782 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp2116900vqg; Mon, 31 Jul 2023 09:13:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlE4nYdZGwvoTYz/DTRn8gdW0g1jU9WjliP7kotlPeFPKOLuNAdaLsDXJD2vyRYddAah4ih2 X-Received: by 2002:a17:90a:a58d:b0:262:f0d0:97c0 with SMTP id b13-20020a17090aa58d00b00262f0d097c0mr9695218pjq.32.1690820021862; Mon, 31 Jul 2023 09:13:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690820021; cv=none; d=google.com; s=arc-20160816; b=h5IHn1F2svYHFEAhIEjfMnw8W5q2tfaB0t38WQE/9MBkiBcHESBLxPtGpYDc8lPYcT ghSTdpyYW1joUq5rsfsS8NOp287CAWcua4zxZkT/48lpszjqXl+VH21Aal8H2sjd6bgX ELZ2yQhOx5W9gn9TIUGrSfuYjcHs7KCYTONytXLhT6q+muPDMzNlpBoSqPcA09EYkNVT jUakRQubgDgfoUpx32u4aKGAOSVgC+jmEYF+mHyfCkoAVQ4O4C+GMKKc8VMAuiKx0goV 4ft8SECyONJ2nHUZ1CTl3X0B9GIV4buGoahdTKEovTckfIikCUy6RQ0ERNnQZY6dxe6i /4ZA== 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=c4Q6nswl7adnvle4sIwtUJF9tAtvVTB8NezbTkNtatk=; fh=tx6UY9TwX+teoyR/HYSM8vHsN0c+VaB2nONDfxVPY2A=; b=BNUkw5IL6nXVYknZCvdj0awSIw6t8EDReyDZ/NTroOlC3f+sLRAZl0l7LxF0LrUv0i rbd9oOq3x6AT5/0wTZZgB0d0S9JfjHMOdEYu9cE6rnVFc8ND5b4KZSfu+r2EeByvyKWn qV7YyRjYfT2z5XgvJlppBVqC1llcU2wp5gU8sp2BoUaz3JrhQf7S4EiiIjIomsCFYPUr 6cOCtk3l/qSsPGTBVTulAo5JWP+BG7gUev9uP49tSy7AQqY2CHHkv3xMWCsExccySzK/ SQqyPAkNHtY271e8isV4y00QWU1I/x5kqOB24XdbdukFW9DQcD6lM99TulheABefg5yL zsMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@posteo.net header.s=2017 header.b=b2rJAhH7; 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 e15-20020a17090a9a8f00b002682b173a2fsi9252229pjp.148.2023.07.31.09.13.28; Mon, 31 Jul 2023 09:13:41 -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=b2rJAhH7; 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 S230494AbjGaPAr (ORCPT + 99 others); Mon, 31 Jul 2023 11:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231495AbjGaPAp (ORCPT ); Mon, 31 Jul 2023 11:00:45 -0400 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.66]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A863A120 for ; Mon, 31 Jul 2023 08:00:41 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 57E70240101 for ; Mon, 31 Jul 2023 17:00:38 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1690815638; bh=IvLmPEmw9kMuEQzvbUm2FqmKdi2Hp7a+u6Dag9e2cQM=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version: Content-Transfer-Encoding:From; b=b2rJAhH7XN+U2h1IPMof9q8aYTETIZR8JWHE47jm5imuVvyCscpcIfhTAfCKl5heH scCYFDGhWc9xmvUBdulpsNHCSSwapO94odN/aORyNToc3hk8bXYd4Kujr+ZWyUxCnc UqUszWhAL/4pPS08fWp3At5vYzgqmzhCtEU3vmFUP0wHd6Tabvhg6axLykF7OY3cNq EIvvioF2ivlt26z7jerets5aHY1V+ONjaxeIMQ9DmmwFH7a5fQ6viHKnNsw34NdZma sTzD8Iw7V+qbptsC9wuDGeNYXSp3flcTtgK7pfEXtwVS7yFfXGTCGlV9NH+g3d/56Y SOoT1hEJgpv6Q== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4RF1dK2GsRz9sDs; Mon, 31 Jul 2023 17:00:37 +0200 (CEST) From: Mark O'Donovan To: linux-kernel@vger.kernel.org Cc: linux-nvme@lists.infradead.org, axboe@kernel.dk, kbusch@kernel.org, hare@suse.de, Mark O'Donovan Subject: [PATCH v2 2/2] nvme-auth: set explanation code for failure2 msgs Date: Mon, 31 Jul 2023 14:51:06 +0000 Message-Id: <20230731145106.917526-2-shiftee@posteo.net> In-Reply-To: <20230731145106.917526-1-shiftee@posteo.net> References: <20230731145106.917526-1-shiftee@posteo.net> MIME-Version: 1.0 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, 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: 1772953295236505621 X-GMAIL-MSGID: 1772953295236505621 Some 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 Reviewed-by: Hannes Reinecke --- v1->v2: Set failure explanation in a single place if the error handling code has not already done so. drivers/nvme/host/auth.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c index e1a98647c3a2..9556cfc4f5f3 100644 --- a/drivers/nvme/host/auth.c +++ b/drivers/nvme/host/auth.c @@ -839,6 +839,8 @@ static void nvme_queue_auth_work(struct work_struct *work) } fail2: + if (chap->status == 0) + chap->status = NVME_AUTH_DHCHAP_FAILURE_FAILED; dev_dbg(ctrl->device, "%s: qid %d send failure2, status %x\n", __func__, chap->qid, chap->status); tl = nvme_auth_set_dhchap_failure2_data(ctrl, chap);