* [PATCH] nvme/tcp: handle rejected keys for secure concatnation
@ 2026-05-11 0:54 Wilfred Mallawa
2026-05-11 6:20 ` Christoph Hellwig
2026-05-11 23:12 ` Damien Le Moal
0 siblings, 2 replies; 3+ messages in thread
From: Wilfred Mallawa @ 2026-05-11 0:54 UTC (permalink / raw)
To: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg
Cc: linux-nvme, linux-kernel, alistair.francis, Wilfred Mallawa
From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
The NVMe-TCP specification [1] states that if the PSK retained or
generated is not available on the subsystem, the TLS 1.3 handshake shall
be aborted with an unknown_psk_identity alert and the connection be
closed.
Currently, when an unknown_psk_identity alert is sent from an endpoint,
tlshd returns EACCES as the TLS error. On subsequent reconnection
attempts, we fail with the same error because we keep attempting to
connect with a stale key. This may occur if the endpoint experienced a
full reset and lost its PSK.
With support in tlshd to return -EKEYREJECTED when an unknown_psk_identity
alert is received, the kernel can now detect this condition and revoke the
current tls_key. This allows the subsequent reconnect to perform
re-authentication via DHCHAP to generate a fresh PSK.
[1] https://nvmexpress.org/wp-content/uploads/NVM-Express-TCP-Transport-Specification-Revision-1.1-2024.08.05-Ratified.pdf
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
---
drivers/nvme/host/tcp.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
index 15d36d6a728e..eff68eb7a5fe 100644
--- a/drivers/nvme/host/tcp.c
+++ b/drivers/nvme/host/tcp.c
@@ -1767,6 +1767,17 @@ static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl,
dev_err(nctrl->device,
"queue %d: TLS handshake complete, error %d\n",
qid, queue->tls_err);
+
+ /*
+ * Key maybe stale, revoke it such that on a subsequent
+ * reconnect, we will generate a new PSK.
+ */
+ if (queue->tls_err == EKEYREJECTED && qid == 0 &&
+ nctrl->opts->concat && nctrl->opts->tls_key) {
+ nvme_auth_revoke_tls_key(nctrl);
+ dev_warn(nctrl->device,
+ "qid 0: revoking stale key\n");
+ }
} else {
dev_dbg(nctrl->device,
"queue %d: TLS handshake complete\n", qid);
--
2.54.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] nvme/tcp: handle rejected keys for secure concatnation
2026-05-11 0:54 [PATCH] nvme/tcp: handle rejected keys for secure concatnation Wilfred Mallawa
@ 2026-05-11 6:20 ` Christoph Hellwig
2026-05-11 23:12 ` Damien Le Moal
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2026-05-11 6:20 UTC (permalink / raw)
To: Wilfred Mallawa
Cc: Keith Busch, Jens Axboe, Christoph Hellwig, Sagi Grimberg,
linux-nvme, linux-kernel, alistair.francis, Wilfred Mallawa
s/concatnation/concatenation/ in the subject.
The changes itself look good to me, but I'd rather leave review to someone
who knows that code.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] nvme/tcp: handle rejected keys for secure concatnation
2026-05-11 0:54 [PATCH] nvme/tcp: handle rejected keys for secure concatnation Wilfred Mallawa
2026-05-11 6:20 ` Christoph Hellwig
@ 2026-05-11 23:12 ` Damien Le Moal
1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2026-05-11 23:12 UTC (permalink / raw)
To: Wilfred Mallawa, Keith Busch, Jens Axboe, Christoph Hellwig,
Sagi Grimberg
Cc: linux-nvme, linux-kernel, alistair.francis, Wilfred Mallawa
On 5/11/26 09:54, Wilfred Mallawa wrote:
> From: Wilfred Mallawa <wilfred.mallawa@wdc.com>
>
In the title: s/concatnation/concatenation
> The NVMe-TCP specification [1] states that if the PSK retained or
> generated is not available on the subsystem, the TLS 1.3 handshake shall
> be aborted with an unknown_psk_identity alert and the connection be
> closed.
>
> Currently, when an unknown_psk_identity alert is sent from an endpoint,
> tlshd returns EACCES as the TLS error. On subsequent reconnection
> attempts, we fail with the same error because we keep attempting to
> connect with a stale key. This may occur if the endpoint experienced a
> full reset and lost its PSK.
>
> With support in tlshd to return -EKEYREJECTED when an unknown_psk_identity
> alert is received, the kernel can now detect this condition and revoke the
> current tls_key. This allows the subsequent reconnect to perform
> re-authentication via DHCHAP to generate a fresh PSK.
>
> [1] https://nvmexpress.org/wp-content/uploads/NVM-Express-TCP-Transport-Specification-Revision-1.1-2024.08.05-Ratified.pdf
>
> Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
> ---
> drivers/nvme/host/tcp.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c
> index 15d36d6a728e..eff68eb7a5fe 100644
> --- a/drivers/nvme/host/tcp.c
> +++ b/drivers/nvme/host/tcp.c
> @@ -1767,6 +1767,17 @@ static int nvme_tcp_start_tls(struct nvme_ctrl *nctrl,
> dev_err(nctrl->device,
> "queue %d: TLS handshake complete, error %d\n",
> qid, queue->tls_err);
> +
> + /*
> + * Key maybe stale, revoke it such that on a subsequent
* If the key is stale, revoke it...
> + * reconnect, we will generate a new PSK.
> + */
> + if (queue->tls_err == EKEYREJECTED && qid == 0 &&
> + nctrl->opts->concat && nctrl->opts->tls_key) {
> + nvme_auth_revoke_tls_key(nctrl);
> + dev_warn(nctrl->device,
> + "qid 0: revoking stale key\n");
> + }
> } else {
> dev_dbg(nctrl->device,
> "queue %d: TLS handshake complete\n", qid);
--
Damien Le Moal
Western Digital Research
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-11 23:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 0:54 [PATCH] nvme/tcp: handle rejected keys for secure concatnation Wilfred Mallawa
2026-05-11 6:20 ` Christoph Hellwig
2026-05-11 23:12 ` Damien Le Moal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox