* [PATCH] wifi: mwifiex: Fix a loop in mwifiex_update_ampdu_rxwinsize()
@ 2026-01-08 20:00 Dan Carpenter
2026-01-08 20:58 ` Johannes Berg
0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2026-01-08 20:00 UTC (permalink / raw)
To: Chunfan Chen
Cc: Brian Norris, Francesco Dolcini, Kalle Valo, Amitkumar Karwar,
Cathy Luo, linux-wireless, linux-kernel, kernel-janitors
The "i" iterator variable is used to count two different things but
unfortunately we can't store two different numbers in the same variable.
Use "i" for the outside loop and "j" for the inside loop.
Cc: stable@vger.kernel.org
Fixes: d219b7eb3792 ("mwifiex: handle BT coex event to adjust Rx BA window size")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
This was found via static analysis so I'm not positive on the impact
of this bug.
drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
index 90831a1350f5..91166b89f918 100644
--- a/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
+++ b/drivers/net/wireless/marvell/mwifiex/11n_rxreorder.c
@@ -826,7 +826,7 @@ void mwifiex_update_rxreor_flags(struct mwifiex_adapter *adapter, u8 flags)
static void mwifiex_update_ampdu_rxwinsize(struct mwifiex_adapter *adapter,
bool coex_flag)
{
- u8 i;
+ u8 i, j;
u32 rx_win_size;
struct mwifiex_private *priv;
@@ -864,8 +864,8 @@ static void mwifiex_update_ampdu_rxwinsize(struct mwifiex_adapter *adapter,
if (rx_win_size != priv->add_ba_param.rx_win_size) {
if (!priv->media_connected)
continue;
- for (i = 0; i < MAX_NUM_TID; i++)
- mwifiex_11n_delba(priv, i);
+ for (j = 0; j < MAX_NUM_TID; j++)
+ mwifiex_11n_delba(priv, j);
}
}
}
--
2.51.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] wifi: mwifiex: Fix a loop in mwifiex_update_ampdu_rxwinsize()
2026-01-08 20:00 [PATCH] wifi: mwifiex: Fix a loop in mwifiex_update_ampdu_rxwinsize() Dan Carpenter
@ 2026-01-08 20:58 ` Johannes Berg
2026-01-12 8:02 ` Jeff Chen
0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2026-01-08 20:58 UTC (permalink / raw)
To: Dan Carpenter, Chunfan Chen
Cc: Brian Norris, Francesco Dolcini, Kalle Valo, Amitkumar Karwar,
Cathy Luo, linux-wireless, linux-kernel, kernel-janitors
On Thu, 2026-01-08 at 23:00 +0300, Dan Carpenter wrote:
> The "i" iterator variable is used to count two different things but
nice catch
> unfortunately we can't store two different numbers in the same variable.
:-)
> This was found via static analysis so I'm not positive on the impact
> of this bug.
I think it basically means anything other than the first interface
(using adapter->priv[i] with i>0) will not be updated correctly for A-
MPDU buffer usage (?) if you use more than two interfaces. Given that
most people probably only use a single interface, I suppose the impact
would be rather low.
johannes
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] wifi: mwifiex: Fix a loop in mwifiex_update_ampdu_rxwinsize()
2026-01-08 20:58 ` Johannes Berg
@ 2026-01-12 8:02 ` Jeff Chen
0 siblings, 0 replies; 3+ messages in thread
From: Jeff Chen @ 2026-01-12 8:02 UTC (permalink / raw)
To: Johannes Berg
Cc: Dan Carpenter, Chunfan Chen, Brian Norris, Francesco Dolcini,
Kalle Valo, Amitkumar Karwar, Cathy Luo, linux-wireless,
linux-kernel, kernel-janitors
On Thu, Jan 08, 2026 at 09:58:46 PM +0100, Johannes Berg wrote:
> On Thu, 2026-01-08 at 23:00 +0300, Dan Carpenter wrote:
> > The "i" iterator variable is used to count two different things but
>
> nice catch
>
> > unfortunately we can't store two different numbers in the same variable.
>
> :-)
>
> > This was found via static analysis so I'm not positive on the impact
> > of this bug.
>
> I think it basically means anything other than the first interface
> (using adapter->priv[i] with i>0) will not be updated correctly for A-
> MPDU buffer usage (?) if you use more than two interfaces. Given that
> most people probably only use a single interface, I suppose the impact
> would be rather low.
>
> johannes
>
Johannes is right — with AP and STA both active, whichever interface first meets
media_connected (AP or STA) will trigger the inner loop to overwrite the outer
interface index, so only that first interface gets the per‑TID delba while the
other is skipped.
For reference: mwifiex_update_ampdu_txwinsize() already uses separate iterators
, so aligning the RX-side loop to the same pattern makes sense.
Dan’s change to use a distinct inner iterator (j) here is correct.
Please apply.
Reviewed-by: Jeff Chen <jeff.chen_1@nxp.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-12 8:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-08 20:00 [PATCH] wifi: mwifiex: Fix a loop in mwifiex_update_ampdu_rxwinsize() Dan Carpenter
2026-01-08 20:58 ` Johannes Berg
2026-01-12 8:02 ` Jeff Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox