Date: Thu, 30 Jul 2026 02:48:04 +0000 From: Kevin Bowling <kbowling@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: bcb62ec0e3d5 - main - igb: Guard register dump during queue setup Message-ID: <6a6abb64.1cdb3.7ee494c8@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch main has been updated by kbowling: URL: https://cgit.FreeBSD.org/src/commit/?id=bcb62ec0e3d592892f0f304269ed2722d1bae75a commit bcb62ec0e3d592892f0f304269ed2722d1bae75a Author: Kevin Bowling <kbowling@FreeBSD.org> AuthorDate: 2026-07-30 02:26:48 +0000 Commit: Kevin Bowling <kbowling@FreeBSD.org> CommitDate: 2026-07-30 02:47:33 +0000 igb: Guard register dump during queue setup The register-dump sysctl is installed before iflib allocates the queue arrays and remains visible while they are freed. Return ENXIO outside the queue lifetime instead of dereferencing a NULL or stale array. Sponsored by: BBOX.io --- sys/dev/e1000/if_em.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sys/dev/e1000/if_em.c b/sys/dev/e1000/if_em.c index eaaa7c5fd2f0..42e7113bff48 100644 --- a/sys/dev/e1000/if_em.c +++ b/sys/dev/e1000/if_em.c @@ -845,6 +845,13 @@ static int em_get_regs(SYSCTL_HANDLER_ARGS) int rc; uint32_t rxqid, txqid; + /* + * This sysctl is registered before iflib allocates the queue arrays, + * and remains registered while iflib tears them down. + */ + if (sc->rx_queues == NULL || sc->tx_queues == NULL) + return (ENXIO); + regs_buff = malloc(sizeof(u32) * IGB_REGS_LEN, M_DEVBUF, M_WAITOK); memset(regs_buff, 0, IGB_REGS_LEN * sizeof(u32)); rxqid = sc->rx_queues[0].rxr.me;home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a6abb64.1cdb3.7ee494c8>
