From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 721923BB695 for ; Tue, 6 Oct 2026 15:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791301120; cv=none; b=WwreI5sV/bG3k7qZnSS/vpxfNWdHl5tVfH37mGDU8hA/ht0MOk+6auWnCmwbmQxxvSWxHO/7b/OtM0fDg8RvXRJADL14b3ykV/WUtjbpAytw6+yEyL3E4cTJoBvtQ9sHiXBmRItl8tmlDDS4dR6jq3W3ovzbGNE/g3S0wb2aRCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1791301120; c=relaxed/simple; bh=g3cCGfhNSC0Zgx51/69AiLxbDJJxZZSn4lkB4CiRI4E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YPi5XvkQTFJJCtdXILM/I1Owha/vEdhNdlOdIz2T0BIV/xYg+YU6RoiJVkejirMUvDc6MB5zQchGMKPnTYDi0UCaGBJCkbWWQQjCXmBLAMB+X0qPFOVoZ1zdtDQqCFwDgo37Sz3XxeVVzGD5Ii2euo/p2RscsN0aGf0I4r0ozz4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=I4uGptYm; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="I4uGptYm" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 486D81F0089B; Tue, 6 Oct 2026 15:38:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1791301119; bh=bg2kxJfrtpnV3xAKnafXKC9/KFLVPombKWa9HRqEKpM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=I4uGptYmRN6VVTYoC0uIjfzJhJtFuKAZB4UTx4H35nkmmzZ+ogaWf2n7Zq9YNHL0U 3gsTVM4nhCc788oEcbaRbQwKTOZTbIupMgnki5NNr8tgP+WqYYCborIxUq3G+HDQZK vdVyQS+Ad7BKXYyGEA1zIDYMmgJfmqqJAcdYarsjtWEb6k2oc6Qi5xN9KVIZLn7qLR gsx+LxxNaBFXg+h4/3T4P+n/OZ13GU0jEYp+3LNv+2OJUgrjdLnxPX0tQburpVlj8p awDL1yC39bACWseW94V8RmB7sBkiBFrVXC0IDgKOZCE+IwfFjI7icUscdoiNdJgv8S 9F5ZR54v36IoQ== From: Sasha Levin To: stable@vger.kernel.org Cc: Alistair Francis , Wilfred Mallawa , Christoph Hellwig , Hannes Reinecke , Sagi Grimberg , Keith Busch , Sasha Levin Subject: [PATCH 6.18.y 1/2] nvmet-tcp: Don't error if TLS is enabed on a reset Date: Tue, 6 Oct 2026 11:38:34 -0400 Message-ID: <20261006153821.760255-1-sashal@kernel.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <2026100502-portal-companion-f7cd@gregkh> References: <2026100502-portal-companion-f7cd@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Alistair Francis [ Upstream commit ecf4d2d883515850ba838df2537ff1c32d0c4217 ] If the host sends a AUTH_Negotiate Message on the admin queue with REPLACETLSPSK set then we expect and require a TLS connection and shouldn't report an error if TLS is enabled. This change only enforces the nvmet_queue_tls_keyid() check if we aren't resetting the negotiation. Signed-off-by: Alistair Francis Reviewed-by: Wilfred Mallawa Reviewed-by: Christoph Hellwig Reviewed-by: Hannes Reinecke Reviewed-by: Sagi Grimberg Signed-off-by: Keith Busch Stable-dep-of: 5211fed41d7e ("nvmet: copy the hostid into the ctrl before creating PR pc_refs") Signed-off-by: Sasha Levin --- drivers/nvme/target/auth.c | 4 ++-- drivers/nvme/target/core.c | 2 +- drivers/nvme/target/fabrics-cmd-auth.c | 3 ++- drivers/nvme/target/nvmet.h | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/target/auth.c b/drivers/nvme/target/auth.c index 95e14f3f03d78..8230a0563616b 100644 --- a/drivers/nvme/target/auth.c +++ b/drivers/nvme/target/auth.c @@ -140,7 +140,7 @@ int nvmet_setup_dhgroup(struct nvmet_ctrl *ctrl, u8 dhgroup_id) return ret; } -u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq) +u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, bool reset) { int ret = 0; struct nvmet_host_link *p; @@ -166,7 +166,7 @@ u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq) goto out_unlock; } - if (nvmet_queue_tls_keyid(sq)) { + if (!reset && nvmet_queue_tls_keyid(sq)) { pr_debug("host %s tls enabled\n", ctrl->hostnqn); goto out_unlock; } diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 1f145b88120ba..1b18523cddb6a 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c @@ -1692,7 +1692,7 @@ struct nvmet_ctrl *nvmet_alloc_ctrl(struct nvmet_alloc_ctrl_args *args) if (args->hostid) uuid_copy(&ctrl->hostid, args->hostid); - dhchap_status = nvmet_setup_auth(ctrl, args->sq); + dhchap_status = nvmet_setup_auth(ctrl, args->sq, false); if (dhchap_status) { pr_err("Failed to setup authentication, dhchap status %u\n", dhchap_status); diff --git a/drivers/nvme/target/fabrics-cmd-auth.c b/drivers/nvme/target/fabrics-cmd-auth.c index 8f19c0737104d..35bf1a2357d49 100644 --- a/drivers/nvme/target/fabrics-cmd-auth.c +++ b/drivers/nvme/target/fabrics-cmd-auth.c @@ -310,7 +310,8 @@ void nvmet_execute_auth_send(struct nvmet_req *req) pr_debug("%s: ctrl %d qid %d reset negotiation\n", __func__, ctrl->cntlid, req->sq->qid); if (!req->sq->qid) { - dhchap_status = nvmet_setup_auth(ctrl, req->sq); + dhchap_status = nvmet_setup_auth(ctrl, req->sq, + true); if (dhchap_status) { pr_err("ctrl %d qid 0 failed to setup re-authentication\n", ctrl->cntlid); diff --git a/drivers/nvme/target/nvmet.h b/drivers/nvme/target/nvmet.h index f2ea7993eabc7..3e8a43df57a67 100644 --- a/drivers/nvme/target/nvmet.h +++ b/drivers/nvme/target/nvmet.h @@ -897,7 +897,7 @@ void nvmet_execute_auth_receive(struct nvmet_req *req); int nvmet_auth_set_key(struct nvmet_host *host, const char *secret, bool set_ctrl); int nvmet_auth_set_host_hash(struct nvmet_host *host, const char *hash); -u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq); +u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, struct nvmet_sq *sq, bool reset); void nvmet_auth_sq_init(struct nvmet_sq *sq); void nvmet_destroy_auth(struct nvmet_ctrl *ctrl); void nvmet_auth_sq_free(struct nvmet_sq *sq); @@ -919,7 +919,7 @@ int nvmet_auth_ctrl_sesskey(struct nvmet_req *req, void nvmet_auth_insert_psk(struct nvmet_sq *sq); #else static inline u8 nvmet_setup_auth(struct nvmet_ctrl *ctrl, - struct nvmet_sq *sq) + struct nvmet_sq *sq, bool reset) { return 0; } -- 2.53.0