From nobody Tue Jul 23 15:46:38 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WT1jC0xjgz5S85s; Tue, 23 Jul 2024 15:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WT1jC0Rh3z4Ym3; Tue, 23 Jul 2024 15:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721749599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qFDYObOxKtz7eANvxLg2SitTh59OMg7lnAx1APcZHVQ=; b=Ak5hJ1RfJ1w7/odAhRhTFwM8ze9phbnM8bfHkXJJ+bcJjSkBXCLxWwlvmIRvgrdzEfxFox fEvn2vnUODET2u3g1D9CALS4HLMRj59ouUd03tksOD3eQeIhCKAYQHdVsxiQUA9yMHJpt0 UN/R8IH8i2uWuZaIMIFFjKC2j/kcNqQ+DxIGO7UBLwX+ocE+bUBGcVjr+BYpYFCfZoESZR hxizvKZnApcCRWkFXBQEcopHVa+OOehUhu2nUyr9brzEX76yFCbIXuFGN63MIHtdD+2ZBo Rpeb4IIvFKrBD0W4C0mdACqv3ARdn8Lc8wMy29yocKJyISuimqU0XmNO+nLeCQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1721749599; a=rsa-sha256; cv=none; b=XAte0X6NkA+kPs3/dplnEbWPBrFVUP4Qb6L3F0reYq9q0rdk9L8G7/KaXpFGzNADbOC7Tq ALEU3sZdHGElLwS5ep5oAYimW2xxF5I/2uK5pwFOnJZDb7cF9ULNSYOoan7LiFVPaqlgHQ 8mkYHR2ueZ9qRhSPAxN2mZ+tsZ1z60jjObJ9PKkjE+JRSLiVG2pCAlfSGyecoyugqFcyp+ 3AiZICo7R3gqqzaQHU8MGYCK514r7SqeTeLALZyn6PNq3YqmvC+qcFqSSwi1pKNEKo4eo/ 4sTJBrQ5miM03wOav/DsGfLebX/1/6rV8NZpcaykclg7LBvO2dpkF021X5NnNw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1721749599; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qFDYObOxKtz7eANvxLg2SitTh59OMg7lnAx1APcZHVQ=; b=dl2EjeWL6JLT42h60WJGUtAgpR25MJ982O3IMwznCzL/AxvlmQLHcz7L4cUdFIe+s+IPZy /rIOmIUn76EIDHgSheEILIjwmCEegJky2+vwJlK8tWIz9MZY5Ick/lfyIgnarIV/yMt0D1 cfqquuCtzYYB3+MMVJm6nh5/VziAVpDkOR8cNsRE2+EL5syRfjDychuEfEU12Hmr+AlW8o xjuDrvdD9i6aLJU7b3C4aLG5fRXzMrXYAeU3HYW7TbLf9FYe+xh83aS2ySAlpBTmMcocpa aiyvT7E5yfjvHIVVJ3LM8+ZnRhKbVRnO4MVyoxI0YnvtT0uoZ2VRSzqiAZLM7Q== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WT1jC02qMzb5C; Tue, 23 Jul 2024 15:46:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 46NFkcQ4059268; Tue, 23 Jul 2024 15:46:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 46NFkcLb059265; Tue, 23 Jul 2024 15:46:38 GMT (envelope-from git) Date: Tue, 23 Jul 2024 15:46:38 GMT Message-Id: <202407231546.46NFkcLb059265@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: dcfa6669a33f - main - nvmft: Handle qpair allocation failures during handoff List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: dcfa6669a33f1bf3dd347f3ab3bef79b5625b4b3 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=dcfa6669a33f1bf3dd347f3ab3bef79b5625b4b3 commit dcfa6669a33f1bf3dd347f3ab3bef79b5625b4b3 Author: John Baldwin AuthorDate: 2024-07-23 15:46:19 +0000 Commit: John Baldwin 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) {