Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jul 2024 15:46:38 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: dcfa6669a33f - main - nvmft: Handle qpair allocation failures during handoff
Message-ID:  <202407231546.46NFkcLb059265@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

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

commit dcfa6669a33f1bf3dd347f3ab3bef79b5625b4b3
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-07-23 15:46:19 +0000
Commit:     John Baldwin <jhb@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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202407231546.46NFkcLb059265>