Re: [PATCH v2] wifi: iwlegacy: 3945-rs: fix possible null-pointer dereferences in il3945_rs_get_rate()

From: Johannes Berg
Date: Thu Jan 08 2026 - 12:00:01 EST


On Wed, 2026-01-07 at 09:59 +0100, Stanislaw Gruszka wrote:
> On Wed, Jan 07, 2026 at 04:41:49PM +0800, Tuo Li wrote:
> > In this function, il_sta is assigned to rs_sta, and rs_sta is dereferenced
> > at several points. If il_sta is NULL, this can lead to null-pointer
> > dereferences. To fix this issue, add an early check for il_sta and return
> > if it is NULL, consistent with the handling in il3945_rs_tx_status().
> >
> > Besides, if the STA il data is uninitialized, return early instead of
> > setting il_sta to NULL, consistent with the handling in
> > il3945_rs_tx_status().
> >
> > Signed-off-by: Tuo Li <islituo@xxxxxxxxx>
> Acked-by: Stanislaw Gruszka <stf_xl@xxxxx>

I can apply this if you want, but for the record,

> > +++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> > @@ -626,10 +626,15 @@ il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta, void *il_sta,
> >
> > D_RATE("enter\n");
> >
> > + if (!il_sta) {
> > + D_RATE("leave: No STA il data to update!\n");
> > + return;
> > + }
> > +

I don't see how this would be possible. _Maybe_ the other one, but I
can't figure out any scenario in mac80211 where it could happen either.

johannes