Date: Tue, 31 Aug 2021 19:13:37 GMT From: Kristof Provost <kp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: bfa89a5dd105 - stable/12 - iflib: fix potential NULL dereference Message-ID: <202108311913.17VJDbcN087133@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by kp: URL: https://cgit.FreeBSD.org/src/commit/?id=bfa89a5dd1055447ee64e0a4cf77898ee970a3b1 commit bfa89a5dd1055447ee64e0a4cf77898ee970a3b1 Author: Kristof Provost <kp@FreeBSD.org> AuthorDate: 2021-08-31 12:11:22 +0000 Commit: Kristof Provost <kp@FreeBSD.org> 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); } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108311913.17VJDbcN087133>