[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260107031203.170628-1-islituo@gmail.com>
Date: Wed, 7 Jan 2026 11:12:03 +0800
From: Tuo Li <islituo@...il.com>
To: toke@...e.dk
Cc: linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org,
Tuo Li <islituo@...il.com>
Subject: [PATCH] wifi: ath9k: add a defensive NULL check to prevent null-pointer dereference in ath9k_beacon_remove_slot()
In this function, bf is guarded by an if statement, indicating that it may
be NULL:
if (bf && bf->bf_mpdu) {...}
If bf is NULL, calling list_add_tail() may result in a null-pointer
dereference:
list_add_tail(&bf->list, &sc->beacon.bbuf);
Therefore, add a defensive NULL check before invoking list_add_tail() to
prevent this issue.
Signed-off-by: Tuo Li <islituo@...il.com>
---
drivers/net/wireless/ath/ath9k/beacon.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 4a27e3753c03..e39e2738ba1a 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -236,7 +236,8 @@ void ath9k_beacon_remove_slot(struct ath_softc *sc, struct ieee80211_vif *vif)
avp->av_bcbuf = NULL;
sc->beacon.bslot[avp->av_bslot] = NULL;
- list_add_tail(&bf->list, &sc->beacon.bbuf);
+ if (bf)
+ list_add_tail(&bf->list, &sc->beacon.bbuf);
tasklet_enable(&sc->bcon_tasklet);
}
--
2.43.0
Powered by blists - more mailing lists