* [PATCH] nvme-fabrics: clarify AUTHREQ result handling
@ 2022-12-08 7:49 Hannes Reinecke
2022-12-08 10:35 ` Sagi Grimberg
2023-01-08 18:21 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Hannes Reinecke @ 2022-12-08 7:49 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Sagi Grimberg, Keith Busch, linux-nvme, Hannes Reinecke, Mark Lehrer
The NVMe 2.0 spec defines the ATR and ASCR bits in the AUTHREQ
connect response field to be mutually exclusive. So to clarify the
handling here switch the AUTHREQ handling to use the bit definitions
and check for both bits.
And while we're at it, add a message to the user that secure
concatenation is not supported (yet).
Suggested-by: Mark Lehrer <mark.lehrer@wdc.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
---
drivers/nvme/host/fabrics.c | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/drivers/nvme/host/fabrics.c b/drivers/nvme/host/fabrics.c
index 7b64357ecd1d..a9ca286c381b 100644
--- a/drivers/nvme/host/fabrics.c
+++ b/drivers/nvme/host/fabrics.c
@@ -410,7 +410,14 @@ int nvmf_connect_admin_queue(struct nvme_ctrl *ctrl)
result = le32_to_cpu(res.u32);
ctrl->cntlid = result & 0xFFFF;
- if ((result >> 16) & 0x3) {
+ if (result & (NVME_CONNECT_AUTHREQ_ATR | NVME_CONNECT_AUTHREQ_ASCR)) {
+ /* Secure concatenation is not implemented */
+ if (result & NVME_CONNECT_AUTHREQ_ASCR) {
+ dev_warn(ctrl->device,
+ "qid 0: secure concatenation is not supported\n");
+ ret = NVME_SC_AUTH_REQUIRED;
+ goto out_free_data;
+ }
/* Authentication required */
ret = nvme_auth_negotiate(ctrl, 0);
if (ret) {
@@ -485,7 +492,14 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
&cmd, data);
}
result = le32_to_cpu(res.u32);
- if ((result >> 16) & 2) {
+ if (result & (NVME_CONNECT_AUTHREQ_ATR | NVME_CONNECT_AUTHREQ_ASCR)) {
+ /* Secure concatenation is not implemented */
+ if (result & NVME_CONNECT_AUTHREQ_ASCR) {
+ dev_warn(ctrl->device,
+ "qid 0: secure concatenation is not supported\n");
+ ret = NVME_SC_AUTH_REQUIRED;
+ goto out_free_data;
+ }
/* Authentication required */
ret = nvme_auth_negotiate(ctrl, qid);
if (ret) {
@@ -498,6 +512,7 @@ int nvmf_connect_io_queue(struct nvme_ctrl *ctrl, u16 qid)
"qid %u: authentication failed\n", qid);
}
}
+out_free_data:
kfree(data);
return ret;
}
--
2.35.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-fabrics: clarify AUTHREQ result handling
2022-12-08 7:49 [PATCH] nvme-fabrics: clarify AUTHREQ result handling Hannes Reinecke
@ 2022-12-08 10:35 ` Sagi Grimberg
2023-01-08 18:21 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Sagi Grimberg @ 2022-12-08 10:35 UTC (permalink / raw)
To: Hannes Reinecke, Christoph Hellwig; +Cc: Keith Busch, linux-nvme, Mark Lehrer
> The NVMe 2.0 spec defines the ATR and ASCR bits in the AUTHREQ
> connect response field to be mutually exclusive. So to clarify the
> handling here switch the AUTHREQ handling to use the bit definitions
> and check for both bits.
> And while we're at it, add a message to the user that secure
> concatenation is not supported (yet).
>
> Suggested-by: Mark Lehrer <mark.lehrer@wdc.com>
> Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme-fabrics: clarify AUTHREQ result handling
2022-12-08 7:49 [PATCH] nvme-fabrics: clarify AUTHREQ result handling Hannes Reinecke
2022-12-08 10:35 ` Sagi Grimberg
@ 2023-01-08 18:21 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2023-01-08 18:21 UTC (permalink / raw)
To: Hannes Reinecke
Cc: Christoph Hellwig, Sagi Grimberg, Keith Busch, linux-nvme, Mark Lehrer
Thanks,
applied to nvme-6.3.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-08 18:21 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-08 7:49 [PATCH] nvme-fabrics: clarify AUTHREQ result handling Hannes Reinecke
2022-12-08 10:35 ` Sagi Grimberg
2023-01-08 18:21 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.