Re: [PATCH net 2/7] nvme-tcp: store negative errno in queue->tls_err
Alistair Francis <[email protected]> Wed, 20 May 2026 12:59:16 +1000
| Newsgroups | dev.linux.lists.kernel-tls-handshake,org.infradead.lists.linux-nvme,org.kernel.vger.netdev |
|---|---|
| Message-ID | <CAKmqyKOvK+MVuVy=tMgyVEPoM6gyQGzc2XCxxgRBK8aqRXM=3A@mail.gmail.com> |
On Tue, May 19, 2026 at 4:29 AM Chuck Lever <[email protected]> wrote: > > From: Chuck Lever <[email protected]> > > nvme_tcp_tls_done() assigns queue->tls_err in three branches. The > ENOKEY lookup failure and the EOPNOTSUPP initializer both store > negative errnos. The third branch, reached when the handshake > layer reports a non-zero status, stores -status. > > The handshake layer delivers status to the consumer callback as a > negative errno; the other in-tree consumers -- > xs_tls_handshake_done() and the nvmet target callback -- treat > their status argument that way. The extra negation in > nvme_tcp_tls_done() flips the sign, leaving tls_err as a positive > value (for instance, +EIO), which nvme_tcp_start_tls() then > returns to its caller. > > Drop the extra negation so queue->tls_err uniformly carries a > negative errno on failure. > > Fixes: be8e82caa685 ("nvme-tcp: enable TLS handshake upcall") > Signed-off-by: Chuck Lever <[email protected]> Reviewed-by: Alistair Francis <[email protected]> Alistair > --- > drivers/nvme/host/tcp.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c > index 15d36d6a728e..68a1d7640494 100644 > --- a/drivers/nvme/host/tcp.c > +++ b/drivers/nvme/host/tcp.c > @@ -1702,7 +1702,7 @@ static void nvme_tcp_tls_done(void *data, int status, key_serial_t pskid) > qid, pskid, status); > > if (status) { > - queue->tls_err = -status; > + queue->tls_err = status; > goto out_complete; > } > > > -- > 2.54.0 > >