]> git.hungrycats.org Git - linux/commitdiff
Merge tag 'nvme-7.4-2026-10-28' of git://git.infradead.org/nvme into block-7.4
authorJens Axboe <axboe@kernel.dk>
Thu, 29 Oct 2026 15:27:59 +0000 (09:27 -0600)
committerJens Axboe <axboe@kernel.dk>
Thu, 29 Oct 2026 15:28:15 +0000 (09:28 -0600)
nvme updates for Linux 7.4

 - Fix regressions from the parallel nvme-tcp I/O queue setup: request
   PDU sizing with header digest, a NULL controller dereference when
   reconnecting with more queues, and early lock initialization
 - Handle TLS control records in nvme-tcp: skip records arriving ahead
   of the ICResp, and start error recovery when the socket read fails
 - Fix an nvme-tcp io_work priority inversion stalling I/O
 - Fix nvme-tcp address attribute race with queue teardown
 - Validate the TLS handshake timeout parameters for host and target
 - Fix fabrics connects with isolated CPUs and queue mapping bugs
 - Fix early boot hang and buffer size for the nvme.quirks parameter
 - Fix nvme-rdma NULL metadata SGL dereference with T10-PI
 - Fix ANA underflow check and an nvme-fc discovery reference leak
 - Fix nvme-loop BUG() when a namespace scan races a reset
 - Target port and configfs locking fixes, and port removal races
 - Target auth fixes for CHALLENGE failure and negotiation handling
 - Target fc fixes for a connection use-after-free, read data on failed
   commands, and admin queue allocation failure teardown
 - Target rdma fix for short connection requests
 - Target rdma fix for inline SGL out-of-bounds write
 - Target rdma refcount, locking, and module unload fixes
 - Target pci-epf SGL length and error status fixes
 - Target NULL dereference fixes for pci-epf and debugfs
 - Target ZNS NUMD overflow check
 - Target Connect fix for a controller leak with a zero queue size
 - Target fixes for a metadata SGL double-free and a leaked blk plug
 - Target fix for truncated large discards
 - Misc cleanups

* tag 'nvme-7.4-2026-10-28' of git://git.infradead.org/nvme: (44 commits)
  nvmet: don't clear sq->ctrl for a Connect with sqsize 0
  nvmet-rdma: fix double puts after a failed RDMA WRITE
  nvmet-rdma: disable interrupts under rsp_wr_wait_lock
  nvmet-rdma: flush nvmet-wq on module exit
  nvme-loop: don't BUG() if a scan runs beside a reset
  nvmet-tcp: don't read a removed port at Connect time
  nvmet: fix NULL dereference in debugfs host_traddr
  nvmet-tcp: stop listening when a port is removed
  nvmet: fix NULL dereference of PCI endpoint targets
  nvmet-auth: take only AUTH_Negotiate for a negotiation
  nvmet: don't truncate the length of big discards
  nvme-tcp: validate the TLS handshake timeout
  nvmet-tcp: validate the TLS handshake timeout
  nvmet: Free the old negotiation state when restarting authentication
  nvmet: Finish the blk plug when integrity allocation fails
  nvme-tcp: fix NULL queue->ctrl dereference on reconnect
  nvme-tcp: Validate the queue state under the queue lock in the address attribute
  nvme-tcp: fix io_work priority inversion when send_mutex is held
  nvme-tcp: fix request PDU size when header digest is enabled
  nvme-tcp: skip TLS control records while waiting for the ICResp
  ...

1  2 
Documentation/admin-guide/kernel-parameters.txt
drivers/nvme/host/fc.c
drivers/nvme/host/pci.c
drivers/nvme/host/tcp.c
drivers/nvme/target/configfs.c
drivers/nvme/target/core.c
drivers/nvme/target/fabrics-cmd-auth.c
drivers/nvme/target/nvmet.h
drivers/nvme/target/pci-epf.c
drivers/nvme/target/tcp.c

Simple merge
Simple merge
index 7190eb10c2481710c3cdb158af6c09704ad186dd,a8e94e4866db2bbd7fea4cb730b6d0e8e2d7efe1..bc46e5f3eaa79ed402cd238caa7300ff7a7bb156
@@@ -1529,9 -1582,144 +1582,139 @@@ static void nvme_tcp_free_queue(struct 
        memalloc_noio_restore(noio_flag);
  
        kfree(queue->pdu);
-       mutex_destroy(&queue->send_mutex);
-       mutex_destroy(&queue->queue_lock);
-       mutex_destroy(&queue->pf_cache_lock);
 -
 -#ifdef CONFIG_DEBUG_LOCK_ALLOC
 -      lockdep_unregister_key(&queue->nvme_tcp_sk_key);
 -      lockdep_unregister_key(&queue->nvme_tcp_slock_key);
 -#endif
+ }
+ 
+ static int nvme_tcp_recv_tls_alert(struct nvme_tcp_queue *queue,
+                                  struct msghdr *msg, int len)
+ {
+       struct sock *sk = queue->sock->sk;
+       u8 level, description;
+ 
+       if (len < 2) {
+               dev_err(queue->ctrl->ctrl.device,
+                       "queue %d: truncated TLS alert\n",
+                       nvme_tcp_queue_id(queue));
+               return -ENOTCONN;
+       }
+ 
+       /* tls_alert_recv() reads through the iterator */
+       iov_iter_revert(&msg->msg_iter, len);
+       tls_alert_recv(sk, msg, &level, &description);
+ 
+       if (level == TLS_ALERT_LEVEL_FATAL) {
+               dev_err(queue->ctrl->ctrl.device,
+                       "queue %d: fatal TLS alert %u\n",
+                       nvme_tcp_queue_id(queue), description);
+               return -ENOTCONN;
+       }
+ 
+       /* a peer shutting down normally is not worth a warning */
+       if (description == TLS_ALERT_DESC_CLOSE_NOTIFY)
+               dev_dbg(queue->ctrl->ctrl.device,
+                       "queue %d: TLS close_notify\n",
+                       nvme_tcp_queue_id(queue));
+       else
+               dev_warn(queue->ctrl->ctrl.device,
+                        "queue %d: TLS alert %u\n",
+                        nvme_tcp_queue_id(queue), description);
+ 
+       return 0;
+ }
+ 
+ /*
+  * Discard a TLS record that arrived in place of the ICResp. A peer may send
+  * a NewSessionTicket as soon as the handshake completes.
+  *
+  * Returns 0 when the record was discarded and the ICResp can be read, or a
+  * negative errno if the connection cannot continue.
+  */
+ static int nvme_tcp_skip_tls_record(struct nvme_tcp_queue *queue,
+                                   struct msghdr *msg, u8 ctype, int len)
+ {
+       u8 buf[NVME_TCP_TLS_REC_CHUNK];
+       int ret;
+ 
+       switch (ctype) {
+       case TLS_RECORD_TYPE_HANDSHAKE:
+               break;
+       case TLS_RECORD_TYPE_ALERT:
+               ret = nvme_tcp_recv_tls_alert(queue, msg, len);
+               return ret ? : -ENOTCONN;
+       default:
+               pr_err("queue %d: unhandled TLS record %u\n",
+                      nvme_tcp_queue_id(queue), ctype);
+               return -ENOTCONN;
+       }
+ 
+       /* the ICResp is in a later record, drain this one first */
+       while (!(msg->msg_flags & MSG_EOR)) {
+               struct kvec iov = {
+                       .iov_base = buf,
+                       .iov_len = sizeof(buf),
+               };
+               char cbuf[CMSG_LEN(sizeof(char))] = {};
+               /* kTLS fails a control record read without a cmsg buffer */
+               struct msghdr drain = {
+                       .msg_control = cbuf,
+                       .msg_controllen = sizeof(cbuf),
+               };
+ 
+               ret = kernel_recvmsg(queue->sock, &drain, &iov, 1, sizeof(buf),
+                                    0);
+               if (ret <= 0) {
+                       pr_warn("queue %d: failed to drain TLS record: %d\n",
+                               nvme_tcp_queue_id(queue), ret);
+                       return ret ? : -ECONNRESET;
+               }
+               msg->msg_flags = drain.msg_flags;
+       }
+ 
+       return 0;
+ }
+ 
+ /*
+  * Receive the ICResp. Over TLS, skip the records that a peer may send
+  * ahead of it.
+  *
+  * Returns the length received, or a negative errno.
+  */
+ static int nvme_tcp_recv_icresp(struct nvme_tcp_queue *queue,
+                               struct nvme_tcp_icresp_pdu *icresp)
+ {
+       char cbuf[CMSG_LEN(sizeof(char))];
+       struct msghdr msg;
+       struct kvec iov;
+       u8 ctype;
+       int i, ret;
+ 
+       for (i = 0; i < NVME_TCP_ICRESP_MAX_RECORDS; i++) {
+               memset(&msg, 0, sizeof(msg));
+               memset(cbuf, 0, sizeof(cbuf));
+               iov.iov_base = icresp;
+               iov.iov_len = sizeof(*icresp);
+               if (nvme_tcp_queue_tls(queue)) {
+                       msg.msg_control = cbuf;
+                       msg.msg_controllen = sizeof(cbuf);
+               }
+               msg.msg_flags = MSG_WAITALL;
+               ret = kernel_recvmsg(queue->sock, &msg, &iov, 1,
+                                    iov.iov_len, msg.msg_flags);
+               if (ret <= 0 || !nvme_tcp_queue_tls(queue))
+                       return ret;
+ 
+               ctype = tls_get_record_type(queue->sock->sk,
+                                           (struct cmsghdr *)cbuf);
+               if (ctype == TLS_RECORD_TYPE_DATA)
+                       return ret;
+ 
+               ret = nvme_tcp_skip_tls_record(queue, &msg, ctype, ret);
+               if (ret < 0)
+                       return ret;
+       }
+ 
+       pr_err("queue %d: too many TLS records before the ICResp\n",
+              nvme_tcp_queue_id(queue));
+       return -EPROTO;
  }
  
  static int nvme_tcp_init_connection(struct nvme_tcp_queue *queue)
@@@ -1986,10 -2171,10 +2162,6 @@@ err_sock
        /* Use sync variant - see nvme_tcp_free_queue() for explanation */
        __fput_sync(queue->sock->file);
        queue->sock = NULL;
- err_destroy_mutex:
-       mutex_destroy(&queue->send_mutex);
-       mutex_destroy(&queue->queue_lock);
-       mutex_destroy(&queue->pf_cache_lock);
 -#ifdef CONFIG_DEBUG_LOCK_ALLOC
 -      lockdep_unregister_key(&queue->nvme_tcp_sk_key);
 -      lockdep_unregister_key(&queue->nvme_tcp_slock_key);
 -#endif
        return ret;
  }
  
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge