* [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication
@ 2023-09-04 15:26 mwilck
2023-09-05 6:51 ` Christoph Hellwig
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: mwilck @ 2023-09-04 15:26 UTC (permalink / raw)
To: Sagi Grimberg, Hannes Reinecke, Christoph Hellwig, linux-nvme
Cc: Daniel Wagner, George, Martin, Kumar, Arun, Martin Wilck
From: Martin Wilck <mwilck@suse.com>
Commit 546dea18c999 ("nvme-auth: check chap ctrl_key once constructed")
replaced the condition "if (ctrl->ctrl_key)" (indicating bidirectional
auth) by "if (chap->ctrl_key)", because ctrl->ctrl_key is a resource shared
with sysfs. But chap->ctrl_key is set in
nvme_auth_process_dhchap_challenge() depending on the DHVLEN in the
DH-HMAC-CHAP Challenge message received from the controller, and will thus
be non-NULL for every DH-HMAC-CHAP exchange, even if unidirectional auth
was requested. This will lead to a protocol violation by sending a Success2
message in the unidirectional case (per NVMe base spec 2.0, the
authentication transaction ends after the Success1 message for
unidirectional auth). Use chap->s2 instead, which is non-zero if and only
if the host requested bi-directional authentication from the controller.
Fixes: 546dea18c999 ("nvme-auth: check chap ctrl_key once constructed")
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
drivers/nvme/host/auth.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/auth.c b/drivers/nvme/host/auth.c
index daf5d144a8ea..064592a5d546 100644
--- a/drivers/nvme/host/auth.c
+++ b/drivers/nvme/host/auth.c
@@ -341,7 +341,7 @@ static int nvme_auth_process_dhchap_success1(struct nvme_ctrl *ctrl,
struct nvmf_auth_dhchap_success1_data *data = chap->buf;
size_t size = sizeof(*data);
- if (chap->ctrl_key)
+ if (chap->s2)
size += chap->hash_len;
if (size > CHAP_BUF_SIZE) {
@@ -825,7 +825,7 @@ static void nvme_queue_auth_work(struct work_struct *work)
goto fail2;
}
- if (chap->ctrl_key) {
+ if (chap->s2) {
/* DH-HMAC-CHAP Step 5: send success2 */
dev_dbg(ctrl->device, "%s: qid %d send success2\n",
__func__, chap->qid);
--
2.42.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication
2023-09-04 15:26 [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication mwilck
@ 2023-09-05 6:51 ` Christoph Hellwig
2023-09-08 7:11 ` Hannes Reinecke
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Christoph Hellwig @ 2023-09-05 6:51 UTC (permalink / raw)
To: mwilck
Cc: Sagi Grimberg, Hannes Reinecke, Christoph Hellwig, linux-nvme,
Daniel Wagner, George, Martin, Kumar, Arun
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication
2023-09-04 15:26 [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication mwilck
2023-09-05 6:51 ` Christoph Hellwig
@ 2023-09-08 7:11 ` Hannes Reinecke
2023-09-12 11:47 ` Sagi Grimberg
2023-10-10 12:19 ` Daniel Wagner
3 siblings, 0 replies; 6+ messages in thread
From: Hannes Reinecke @ 2023-09-08 7:11 UTC (permalink / raw)
To: mwilck, Sagi Grimberg, Christoph Hellwig, linux-nvme
Cc: Daniel Wagner, George, Martin, Kumar, Arun
On 9/4/23 17:26, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
>
> Commit 546dea18c999 ("nvme-auth: check chap ctrl_key once constructed")
> replaced the condition "if (ctrl->ctrl_key)" (indicating bidirectional
> auth) by "if (chap->ctrl_key)", because ctrl->ctrl_key is a resource shared
> with sysfs. But chap->ctrl_key is set in
> nvme_auth_process_dhchap_challenge() depending on the DHVLEN in the
> DH-HMAC-CHAP Challenge message received from the controller, and will thus
> be non-NULL for every DH-HMAC-CHAP exchange, even if unidirectional auth
> was requested. This will lead to a protocol violation by sending a Success2
> message in the unidirectional case (per NVMe base spec 2.0, the
> authentication transaction ends after the Success1 message for
> unidirectional auth). Use chap->s2 instead, which is non-zero if and only
> if the host requested bi-directional authentication from the controller.
>
> Fixes: 546dea18c999 ("nvme-auth: check chap ctrl_key once constructed")
> Signed-off-by: Martin Wilck <mwilck@suse.com>
> ---
> drivers/nvme/host/auth.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@suse.de +49 911 74053 688
SUSE Software Solutions GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), Geschäftsführer: Ivo Totev, Andrew
Myers, Andrew McDonald, Martje Boudien Moerman
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication
2023-09-04 15:26 [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication mwilck
2023-09-05 6:51 ` Christoph Hellwig
2023-09-08 7:11 ` Hannes Reinecke
@ 2023-09-12 11:47 ` Sagi Grimberg
2023-10-10 12:19 ` Daniel Wagner
3 siblings, 0 replies; 6+ messages in thread
From: Sagi Grimberg @ 2023-09-12 11:47 UTC (permalink / raw)
To: mwilck, Hannes Reinecke, Christoph Hellwig, linux-nvme
Cc: Daniel Wagner, George, Martin, Kumar, Arun
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication
2023-09-04 15:26 [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication mwilck
` (2 preceding siblings ...)
2023-09-12 11:47 ` Sagi Grimberg
@ 2023-10-10 12:19 ` Daniel Wagner
2023-10-10 15:03 ` Keith Busch
3 siblings, 1 reply; 6+ messages in thread
From: Daniel Wagner @ 2023-10-10 12:19 UTC (permalink / raw)
To: mwilck
Cc: Sagi Grimberg, Hannes Reinecke, Christoph Hellwig, linux-nvme,
George, Martin, Kumar, Arun
On Mon, Sep 04, 2023 at 05:26:38PM +0200, mwilck@suse.com wrote:
> From: Martin Wilck <mwilck@suse.com>
>
> Commit 546dea18c999 ("nvme-auth: check chap ctrl_key once constructed")
> replaced the condition "if (ctrl->ctrl_key)" (indicating bidirectional
> auth) by "if (chap->ctrl_key)", because ctrl->ctrl_key is a resource shared
> with sysfs. But chap->ctrl_key is set in
> nvme_auth_process_dhchap_challenge() depending on the DHVLEN in the
> DH-HMAC-CHAP Challenge message received from the controller, and will thus
> be non-NULL for every DH-HMAC-CHAP exchange, even if unidirectional auth
> was requested. This will lead to a protocol violation by sending a Success2
> message in the unidirectional case (per NVMe base spec 2.0, the
> authentication transaction ends after the Success1 message for
> unidirectional auth). Use chap->s2 instead, which is non-zero if and only
> if the host requested bi-directional authentication from the controller.
>
> Fixes: 546dea18c999 ("nvme-auth: check chap ctrl_key once constructed")
> Signed-off-by: Martin Wilck <mwilck@suse.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Any chance to get this applied?
Thanks!
Daniel
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication
2023-10-10 12:19 ` Daniel Wagner
@ 2023-10-10 15:03 ` Keith Busch
0 siblings, 0 replies; 6+ messages in thread
From: Keith Busch @ 2023-10-10 15:03 UTC (permalink / raw)
To: Daniel Wagner
Cc: mwilck, Sagi Grimberg, Hannes Reinecke, Christoph Hellwig,
linux-nvme, George, Martin, Kumar, Arun
On Tue, Oct 10, 2023 at 02:19:12PM +0200, Daniel Wagner wrote:
> Any chance to get this applied?
Applied for nvme-6.6 now, thank you for the ping!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-10-10 15:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-04 15:26 [PATCH] nvme-auth: use chap->s2 to indicate bidirectional authentication mwilck
2023-09-05 6:51 ` Christoph Hellwig
2023-09-08 7:11 ` Hannes Reinecke
2023-09-12 11:47 ` Sagi Grimberg
2023-10-10 12:19 ` Daniel Wagner
2023-10-10 15:03 ` Keith Busch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox