The branch main has been updated by jhb:

URL: 
https://cgit.FreeBSD.org/src/commit/?id=dcfa6669a33f1bf3dd347f3ab3bef79b5625b4b3

commit dcfa6669a33f1bf3dd347f3ab3bef79b5625b4b3
Author:     John Baldwin <j...@freebsd.org>
AuthorDate: 2024-07-23 15:46:19 +0000
Commit:     John Baldwin <j...@freebsd.org>
CommitDate: 2024-07-23 15:46:19 +0000

    nvmft: Handle qpair allocation failures during handoff
    
    If the transport fails to create a queue pair, fail with an error
    rather than dereferencing a NULL pointer.
    
    Sponsored by:   Chelsio Communications
---
 sys/dev/nvmf/controller/nvmft_controller.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/sys/dev/nvmf/controller/nvmft_controller.c 
b/sys/dev/nvmf/controller/nvmft_controller.c
index f3783eac1275..dee4d8c92d3d 100644
--- a/sys/dev/nvmf/controller/nvmft_controller.c
+++ b/sys/dev/nvmf/controller/nvmft_controller.c
@@ -122,6 +122,11 @@ nvmft_handoff_admin_queue(struct nvmft_port *np,
 
        qp = nvmft_qpair_init(handoff->trtype, &handoff->params, 0,
            "admin queue");
+       if (qp == NULL) {
+               printf("NVMFT: Failed to setup admin queue from %.*s\n",
+                   (int)sizeof(data->hostnqn), data->hostnqn);
+               return (ENXIO);
+       }
 
        sx_xlock(&np->lock);
        cntlid = alloc_unr(np->ids);
@@ -187,6 +192,11 @@ nvmft_handoff_io_queue(struct nvmft_port *np,
 
        snprintf(name, sizeof(name), "I/O queue %u", qid);
        qp = nvmft_qpair_init(handoff->trtype, &handoff->params, qid, name);
+       if (qp == NULL) {
+               printf("NVMFT: Failed to setup I/O queue %u from %.*s\n", qid,
+                   (int)sizeof(data->hostnqn), data->hostnqn);
+               return (ENXIO);
+       }
 
        sx_slock(&np->lock);
        TAILQ_FOREACH(ctrlr, &np->controllers, link) {

Reply via email to