public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iwlegacy: 3945-mac: Fix GFP flags in allocation loop
@ 2026-03-27 12:30 Brendan Jackman
  2026-03-27 12:52 ` Stanislaw Gruszka
  0 siblings, 1 reply; 2+ messages in thread
From: Brendan Jackman @ 2026-03-27 12:30 UTC (permalink / raw)
  To: Stanislaw Gruszka; +Cc: linux-wireless, linux-kernel, Brendan Jackman

Do not latch these flags, they should be re-evaluated for each
iteration of the loop.

Concretely, rxq->free_count is incremented during the loop so the
__GFP_NOWARN decision may be stale. There may be other reasons to
require the re-evaluation too.

Suggested-by: Stanislaw Gruszka <stf_xl@wp.pl>
Link: https://lore.kernel.org/all/20260327115739.GB16800@wp.pl/
Signed-off-by: Brendan Jackman <jackmanb@google.com>
---
Transparency note: I am 100% taking Stanislaw's word for this. The bug
being fixed here hasn't been reproduced and I don't have a way to test
this patch at all. It does seem to make sense to me though and, well,
Stanislaw is the mantainer :)
---
 drivers/net/wireless/intel/iwlegacy/3945-mac.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
index c148654aa9533..e8ae6687c08ec 100644
--- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c
+++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
@@ -979,9 +979,10 @@ il3945_rx_allocate(struct il_priv *il, gfp_t priority)
 	struct page *page;
 	dma_addr_t page_dma;
 	unsigned long flags;
-	gfp_t gfp_mask = priority;
 
 	while (1) {
+		gfp_t gfp_mask = priority;
+
 		spin_lock_irqsave(&rxq->lock, flags);
 		if (list_empty(&rxq->rx_used)) {
 			spin_unlock_irqrestore(&rxq->lock, flags);

---
base-commit: 0138af2472dfdef0d56fc4697416eaa0ff2589bd
change-id: 20260327-iwlegacy-gfp-fix-d553e3340b4f

Best regards,
-- 
Brendan Jackman <jackmanb@google.com>


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iwlegacy: 3945-mac: Fix GFP flags in allocation loop
  2026-03-27 12:30 [PATCH] iwlegacy: 3945-mac: Fix GFP flags in allocation loop Brendan Jackman
@ 2026-03-27 12:52 ` Stanislaw Gruszka
  0 siblings, 0 replies; 2+ messages in thread
From: Stanislaw Gruszka @ 2026-03-27 12:52 UTC (permalink / raw)
  To: Brendan Jackman; +Cc: linux-wireless, linux-kernel

On Fri, Mar 27, 2026 at 12:30:07PM +0000, Brendan Jackman wrote:
> Do not latch these flags, they should be re-evaluated for each
> iteration of the loop.
> 
> Concretely, rxq->free_count is incremented during the loop so the
> __GFP_NOWARN decision may be stale. There may be other reasons to
> require the re-evaluation too.
> 
> Suggested-by: Stanislaw Gruszka <stf_xl@wp.pl>
> Link: https://lore.kernel.org/all/20260327115739.GB16800@wp.pl/
> Signed-off-by: Brendan Jackman <jackmanb@google.com>
Acked-by: Stanislaw Gruszka <stf_xl@wp.pl>

> ---
> Transparency note: I am 100% taking Stanislaw's word for this. The bug
> being fixed here hasn't been reproduced and I don't have a way to test
> this patch at all. It does seem to make sense to me though and, well,
> Stanislaw is the mantainer :)
> ---
>  drivers/net/wireless/intel/iwlegacy/3945-mac.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/wireless/intel/iwlegacy/3945-mac.c b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
> index c148654aa9533..e8ae6687c08ec 100644
> --- a/drivers/net/wireless/intel/iwlegacy/3945-mac.c
> +++ b/drivers/net/wireless/intel/iwlegacy/3945-mac.c
> @@ -979,9 +979,10 @@ il3945_rx_allocate(struct il_priv *il, gfp_t priority)
>  	struct page *page;
>  	dma_addr_t page_dma;
>  	unsigned long flags;
> -	gfp_t gfp_mask = priority;
>  
>  	while (1) {
> +		gfp_t gfp_mask = priority;
> +
>  		spin_lock_irqsave(&rxq->lock, flags);
>  		if (list_empty(&rxq->rx_used)) {
>  			spin_unlock_irqrestore(&rxq->lock, flags);
> 
> ---
> base-commit: 0138af2472dfdef0d56fc4697416eaa0ff2589bd
> change-id: 20260327-iwlegacy-gfp-fix-d553e3340b4f
> 
> Best regards,
> -- 
> Brendan Jackman <jackmanb@google.com>
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-27 12:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 12:30 [PATCH] iwlegacy: 3945-mac: Fix GFP flags in allocation loop Brendan Jackman
2026-03-27 12:52 ` Stanislaw Gruszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox