* [PATCH] iwlegacy: 3945-rs: fix possible null-pointer dereferences in il3945_rs_get_rate()
@ 2026-01-07 7:10 Tuo Li
2026-01-07 7:44 ` Stanislaw Gruszka
0 siblings, 1 reply; 4+ messages in thread
From: Tuo Li @ 2026-01-07 7:10 UTC (permalink / raw)
To: stf_xl; +Cc: linux-wireless, linux-kernel, Tuo Li
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().
Signed-off-by: Tuo Li <islituo@gmail.com>
---
drivers/net/wireless/intel/iwlegacy/3945-rs.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/net/wireless/intel/iwlegacy/3945-rs.c b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
index 1826c37c090c..c13268093a6e 100644
--- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c
+++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
@@ -626,8 +626,13 @@ 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 available!\n");
+ return;
+ }
+
/* Treat uninitialized rate scaling data same as non-existing. */
- if (rs_sta && !rs_sta->il) {
+ if (!rs_sta->il) {
D_RATE("Rate scaling information not initialized yet.\n");
il_sta = NULL;
}
--
2.43.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH] iwlegacy: 3945-rs: fix possible null-pointer dereferences in il3945_rs_get_rate()
2026-01-07 7:10 [PATCH] iwlegacy: 3945-rs: fix possible null-pointer dereferences in il3945_rs_get_rate() Tuo Li
@ 2026-01-07 7:44 ` Stanislaw Gruszka
2026-01-07 8:06 ` Stanislaw Gruszka
0 siblings, 1 reply; 4+ messages in thread
From: Stanislaw Gruszka @ 2026-01-07 7:44 UTC (permalink / raw)
To: Tuo Li; +Cc: linux-wireless, linux-kernel
On Wed, Jan 07, 2026 at 03:10:01PM +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().
>
> Signed-off-by: Tuo Li <islituo@gmail.com>
> ---
> drivers/net/wireless/intel/iwlegacy/3945-rs.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/intel/iwlegacy/3945-rs.c b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> index 1826c37c090c..c13268093a6e 100644
> --- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> +++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> @@ -626,8 +626,13 @@ 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 available!\n");
> + return;
> + }
> +
> /* Treat uninitialized rate scaling data same as non-existing. */
> - if (rs_sta && !rs_sta->il) {
> + if (!rs_sta->il) {
> D_RATE("Rate scaling information not initialized yet.\n");
> il_sta = NULL;
Please also change to return here instead of setting il_sta to NULL.
And make D_RATE messages similar to il3945_rs_tx_status() i.e. :
if (!il_sta) {
D_RATE("leave: No STA il data to update!\n");
return;
}
/* Treat uninitialized rate scaling data same as non-existing. */
if (!rs_sta->il) {
D_RATE("leave: STA il data uninitialized!\n");
return;
}
Thanks
Stanislaw
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] iwlegacy: 3945-rs: fix possible null-pointer dereferences in il3945_rs_get_rate()
2026-01-07 7:44 ` Stanislaw Gruszka
@ 2026-01-07 8:06 ` Stanislaw Gruszka
2026-01-07 8:16 ` Tuo Li
0 siblings, 1 reply; 4+ messages in thread
From: Stanislaw Gruszka @ 2026-01-07 8:06 UTC (permalink / raw)
To: Tuo Li; +Cc: linux-wireless, linux-kernel
On Wed, Jan 07, 2026 at 08:44:40AM +0100, Stanislaw Gruszka wrote:
> On Wed, Jan 07, 2026 at 03:10:01PM +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().
> >
> > Signed-off-by: Tuo Li <islituo@gmail.com>
> > ---
> > drivers/net/wireless/intel/iwlegacy/3945-rs.c | 7 ++++++-
> > 1 file changed, 6 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/wireless/intel/iwlegacy/3945-rs.c b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> > index 1826c37c090c..c13268093a6e 100644
> > --- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> > +++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> > @@ -626,8 +626,13 @@ 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 available!\n");
> > + return;
> > + }
> > +
> > /* Treat uninitialized rate scaling data same as non-existing. */
> > - if (rs_sta && !rs_sta->il) {
> > + if (!rs_sta->il) {
> > D_RATE("Rate scaling information not initialized yet.\n");
> > il_sta = NULL;
> Please also change to return here instead of setting il_sta to NULL.
> And make D_RATE messages similar to il3945_rs_tx_status() i.e. :
>
> if (!il_sta) {
> D_RATE("leave: No STA il data to update!\n");
> return;
> }
>
> /* Treat uninitialized rate scaling data same as non-existing. */
> if (!rs_sta->il) {
> D_RATE("leave: STA il data uninitialized!\n");
> return;
> }
Please also add 'wifi:' prefix to the patch title.
Thanks
Stanislaw
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] iwlegacy: 3945-rs: fix possible null-pointer dereferences in il3945_rs_get_rate()
2026-01-07 8:06 ` Stanislaw Gruszka
@ 2026-01-07 8:16 ` Tuo Li
0 siblings, 0 replies; 4+ messages in thread
From: Tuo Li @ 2026-01-07 8:16 UTC (permalink / raw)
To: Stanislaw Gruszka; +Cc: linux-wireless, linux-kernel
On Wed, Jan 7, 2026 at 4:06 PM Stanislaw Gruszka <stf_xl@wp.pl> wrote:
>
> On Wed, Jan 07, 2026 at 08:44:40AM +0100, Stanislaw Gruszka wrote:
> > On Wed, Jan 07, 2026 at 03:10:01PM +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().
> > >
> > > Signed-off-by: Tuo Li <islituo@gmail.com>
> > > ---
> > > drivers/net/wireless/intel/iwlegacy/3945-rs.c | 7 ++++++-
> > > 1 file changed, 6 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/net/wireless/intel/iwlegacy/3945-rs.c b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> > > index 1826c37c090c..c13268093a6e 100644
> > > --- a/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> > > +++ b/drivers/net/wireless/intel/iwlegacy/3945-rs.c
> > > @@ -626,8 +626,13 @@ 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 available!\n");
> > > + return;
> > > + }
> > > +
> > > /* Treat uninitialized rate scaling data same as non-existing. */
> > > - if (rs_sta && !rs_sta->il) {
> > > + if (!rs_sta->il) {
> > > D_RATE("Rate scaling information not initialized yet.\n");
> > > il_sta = NULL;
> > Please also change to return here instead of setting il_sta to NULL.
> > And make D_RATE messages similar to il3945_rs_tx_status() i.e. :
> >
> > if (!il_sta) {
> > D_RATE("leave: No STA il data to update!\n");
> > return;
> > }
> >
> > /* Treat uninitialized rate scaling data same as non-existing. */
> > if (!rs_sta->il) {
> > D_RATE("leave: STA il data uninitialized!\n");
> > return;
> > }
>
> Please also add 'wifi:' prefix to the patch title.
>
> Thanks
> Stanislaw
Hi Stanislaw,
Thank you for your reply. I will update the patch according to your
suggestions and submit a v2.
Sincerely,
Tuo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-01-07 8:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-07 7:10 [PATCH] iwlegacy: 3945-rs: fix possible null-pointer dereferences in il3945_rs_get_rate() Tuo Li
2026-01-07 7:44 ` Stanislaw Gruszka
2026-01-07 8:06 ` Stanislaw Gruszka
2026-01-07 8:16 ` Tuo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox