git: cf879fdb4820 - releng/14.1 - fib_dxr: KASSERTs for chasing NULL ptr and runaway refcount suspects

From: Marko Zec <zec_at_FreeBSD.org>
Date: Thu, 23 May 2024 05:37:28 UTC
The branch releng/14.1 has been updated by zec:

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

commit cf879fdb482034f73150fd47aed60ff6e57110f8
Author:     Marko Zec <zec@FreeBSD.org>
AuthorDate: 2024-05-07 15:22:00 +0000
Commit:     Marko Zec <zec@FreeBSD.org>
CommitDate: 2024-05-23 04:28:02 +0000

    fib_dxr: KASSERTs for chasing NULL ptr and runaway refcount suspects
    
    MFC after:      1 week
    Approved by:    re (cperciva)
    
    (cherry picked from commit 52075e4cfabc30d08605ec296b2b374d61e2e2bb)
---
 sys/netinet/in_fib_dxr.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/sys/netinet/in_fib_dxr.c b/sys/netinet/in_fib_dxr.c
index 69332b859099..8b1e92d01d35 100644
--- a/sys/netinet/in_fib_dxr.c
+++ b/sys/netinet/in_fib_dxr.c
@@ -1280,6 +1280,9 @@ dxr_change_rib_batch(struct rib_head *rnh, struct fib_change_queue *q,
 
 	da = dxr->aux;
 	KASSERT(da != NULL, ("%s: NULL dxr->aux", __FUNCTION__));
+	KASSERT(da->fd != NULL, ("%s: da->fd %p", __FUNCTION__, da->fd));
+	KASSERT(da->refcnt > 0, ("%s: da->refcnt %d", __FUNCTION__,
+	    da->refcnt));
 
 	FIB_PRINTF(LOG_INFO, da->fd, "processing %d update(s)", q->count);
 	for (ui = 0; ui < q->count; ui++) {