From owner-dev-commits-src-branches@freebsd.org Tue Aug 31 19:13:37 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 980B2673DFF; Tue, 31 Aug 2021 19:13:37 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GzcKs3tZxz4v3B; Tue, 31 Aug 2021 19:13:37 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 6DE5917706; Tue, 31 Aug 2021 19:13:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 17VJDbtW087134; Tue, 31 Aug 2021 19:13:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 17VJDbcN087133; Tue, 31 Aug 2021 19:13:37 GMT (envelope-from git) Date: Tue, 31 Aug 2021 19:13:37 GMT Message-Id: <202108311913.17VJDbcN087133@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Kristof Provost Subject: git: bfa89a5dd105 - stable/12 - iflib: fix potential NULL dereference MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kp X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: bfa89a5dd1055447ee64e0a4cf77898ee970a3b1 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 31 Aug 2021 19:13:37 -0000 The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bfa89a5dd1055447ee64e0a4cf77898ee970a3b1 commit bfa89a5dd1055447ee64e0a4cf77898ee970a3b1 Author: Kristof Provost AuthorDate: 2021-08-31 12:11:22 +0000 Commit: Kristof Provost CommitDate: 2021-08-31 19:12:50 +0000 iflib: fix potential NULL dereference iflib_softirq_alloc_generic() can be called with a NULL irq parameter (as done by for example the bnxt and ixl drivers). If iflib_irq_set_affinity() then returns an error we'd try to dereference the NULL irq pointer. Check irq, and pass '-1' (which taskqgroup_attach() expects) if we don't have an irq. Direct commit to stable/12, because this issue does not exist on main and stable/13. Reviewed by: kbowling Sponsored by: Rubicon Communications, LLC ("Netgate") Differential Revision: https://reviews.freebsd.org/D31758 --- sys/net/iflib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/net/iflib.c b/sys/net/iflib.c index 8dc1715e625d..f8d4c120b3ec 100644 --- a/sys/net/iflib.c +++ b/sys/net/iflib.c @@ -6200,7 +6200,7 @@ iflib_irq_set_affinity(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, base_cpuid = ctx->ifc_sysctl_core_offset; cpuid = get_cpuid_for_queue(ctx, base_cpuid, qid, type == IFLIB_INTR_TX); err = taskqgroup_attach_cpu(tqg, gtask, uniq, cpuid, - rman_get_start(irq->ii_res), name); + irq ? rman_get_start(irq->ii_res) : -1, name); if (err) { device_printf(dev, "taskqgroup_attach_cpu failed %d\n", err); return (err); @@ -6337,7 +6337,7 @@ iflib_softirq_alloc_generic(if_ctx_t ctx, if_irq_t irq, iflib_intr_type_t type, err = iflib_irq_set_affinity(ctx, irq, type, qid, gtask, tqg, q, name); if (err) { dev = ctx->ifc_dev; - taskqgroup_attach(tqg, gtask, q, rman_get_start(irq->ii_res), + taskqgroup_attach(tqg, gtask, q, irq ? rman_get_start(irq->ii_res) : -1, name); } }