Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: rtw88: debugfs: don't vzalloc(0) when rsvd_page is read unconfigured
@ 2026-08-27 12:48 Abdurrahman Karadag
  2026-08-27 13:12 ` [PATCH v2 wireless] " Abdurrahman Karadag
  0 siblings, 1 reply; 5+ messages in thread
From: Abdurrahman Karadag @ 2026-08-27 12:48 UTC (permalink / raw)
  To: linux-wireless; +Cc: pkshih, Abdurrahman Karadag

Reading the rsvd_page debugfs entry before writing a page offset and
count to it calls vzalloc() with a size of zero, because
rsvd_page.page_num defaults to 0.  vmalloc warns about this:

  WARNING: mm/vmalloc.c:4019 at __vmalloc_node_range_noprof+0x9ac/0xa30
  ...
  Call Trace:
   __vmalloc_node_noprof+0x4c/0x70
   rtw_debugfs_get_rsvd_page+0x4c/0x110 [rtw88_core]
   seq_read_iter+0x132/0x4b0
   seq_read+0x12e/0x1c0
   full_proxy_read+0x6f/0xc0
   vfs_read+0xdd/0x490

rtw_fw_dump_fifo() would reject the zero size anyway, but only after
the allocation.  Check for a zero buffer size first and print a short
usage hint instead of allocating.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Abdurrahman Karadag <abdurrahmankaradag19@gmail.com>
---
 drivers/net/wireless/realtek/rtw88/debug.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index b67d69b..84e45af 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -315,6 +315,11 @@ static int rtw_debugfs_get_rsvd_page(struct seq_file *m, void *v)
 	int i;
 	int ret;
 
+	if (!buf_size) {
+		seq_puts(m, "usage: echo <page_offset> <page_num> > rsvd_page\n");
+		return 0;
+	}
+
 	buf = vzalloc(buf_size);
 	if (!buf)
 		return -ENOMEM;
-- 
2.55.0


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

* [PATCH v2 wireless] wifi: rtw88: debugfs: don't vzalloc(0) when rsvd_page is read unconfigured
  2026-08-27 12:48 [PATCH] wifi: rtw88: debugfs: don't vzalloc(0) when rsvd_page is read unconfigured Abdurrahman Karadag
@ 2026-08-27 13:12 ` Abdurrahman Karadag
  2026-08-28  0:42   ` Ping-Ke Shih
  2026-09-02  3:51   ` Ping-Ke Shih
  0 siblings, 2 replies; 5+ messages in thread
From: Abdurrahman Karadag @ 2026-08-27 13:12 UTC (permalink / raw)
  To: linux-wireless; +Cc: pkshih, johannes, kvalo, briannorris, Abdurrahman Karadag

Reading the rsvd_page debugfs entry before writing a page offset and
count to it calls vzalloc() with a size of zero, because
rsvd_page.page_num defaults to 0.  vmalloc warns about this:

  WARNING: mm/vmalloc.c:4019 at __vmalloc_node_range_noprof+0x9ac/0xa30
  ...
  Call Trace:
   __vmalloc_node_noprof+0x4c/0x70
   rtw_debugfs_get_rsvd_page+0x4c/0x110 [rtw88_core]
   seq_read_iter+0x132/0x4b0
   seq_read+0x12e/0x1c0
   full_proxy_read+0x6f/0xc0
   vfs_read+0xdd/0x490

rtw_fw_dump_fifo() would reject the zero size anyway, but only after
the allocation.  Check for a zero buffer size first and print a short
usage hint instead of allocating.

Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
Signed-off-by: Abdurrahman Karadag <abdurrahmankaradag19@gmail.com>
---
v2: no code change. Add the wireless target tree to the subject and Cc
    the maintainers/blamed authors that v1 missed.

 drivers/net/wireless/realtek/rtw88/debug.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/wireless/realtek/rtw88/debug.c b/drivers/net/wireless/realtek/rtw88/debug.c
index b67d69b..84e45af 100644
--- a/drivers/net/wireless/realtek/rtw88/debug.c
+++ b/drivers/net/wireless/realtek/rtw88/debug.c
@@ -315,6 +315,11 @@ static int rtw_debugfs_get_rsvd_page(struct seq_file *m, void *v)
 	int i;
 	int ret;
 
+	if (!buf_size) {
+		seq_puts(m, "usage: echo <page_offset> <page_num> > rsvd_page\n");
+		return 0;
+	}
+
 	buf = vzalloc(buf_size);
 	if (!buf)
 		return -ENOMEM;
-- 
2.55.0


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

* RE: [PATCH v2 wireless] wifi: rtw88: debugfs: don't vzalloc(0) when rsvd_page is read unconfigured
  2026-08-27 13:12 ` [PATCH v2 wireless] " Abdurrahman Karadag
@ 2026-08-28  0:42   ` Ping-Ke Shih
       [not found]     ` <CA+tD5P_CN_g6eFzbYW9AvgCDZ8z4dieahFAOScXssC_HY1XDOg@mail.gmail.com>
  2026-09-02  3:51   ` Ping-Ke Shih
  1 sibling, 1 reply; 5+ messages in thread
From: Ping-Ke Shih @ 2026-08-28  0:42 UTC (permalink / raw)
  To: Abdurrahman Karadag, linux-wireless@vger.kernel.org
  Cc: johannes@sipsolutions.net, kvalo@kernel.org,
	briannorris@chromium.org

Abdurrahman Karadag <abdurrahmankaradag19@gmail.com> wrote:
> Reading the rsvd_page debugfs entry before writing a page offset and
> count to it calls vzalloc() with a size of zero, because
> rsvd_page.page_num defaults to 0.  vmalloc warns about this:
> 
>   WARNING: mm/vmalloc.c:4019 at __vmalloc_node_range_noprof+0x9ac/0xa30
>   ...
>   Call Trace:
>    __vmalloc_node_noprof+0x4c/0x70
>    rtw_debugfs_get_rsvd_page+0x4c/0x110 [rtw88_core]
>    seq_read_iter+0x132/0x4b0
>    seq_read+0x12e/0x1c0
>    full_proxy_read+0x6f/0xc0
>    vfs_read+0xdd/0x490
> 
> rtw_fw_dump_fifo() would reject the zero size anyway, but only after
> the allocation.  Check for a zero buffer size first and print a short
> usage hint instead of allocating.
> 
> Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
> Signed-off-by: Abdurrahman Karadag <abdurrahmankaradag19@gmail.com>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>

> ---
> v2: no code change. Add the wireless target tree to the subject and Cc
>     the maintainers/blamed authors that v1 missed.

Actually, target tree of Realtek Wifi driver should be rtw-next or rtw. 

[1] https://github.com/pkshih/rtw.git rtw-next



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

* RE: [PATCH v2 wireless] wifi: rtw88: debugfs: don't vzalloc(0) when rsvd_page is read unconfigured
       [not found]     ` <CA+tD5P_CN_g6eFzbYW9AvgCDZ8z4dieahFAOScXssC_HY1XDOg@mail.gmail.com>
@ 2026-08-28  9:31       ` Ping-Ke Shih
  0 siblings, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2026-08-28  9:31 UTC (permalink / raw)
  To: Abdurrahman Karadağ
  Cc: linux-wireless@vger.kernel.org, johannes@sipsolutions.net,
	kvalo@kernel.org, briannorris@chromium.org

(convert to plain text mode)

Abdurrahman Karadağ <abdurrahmankaradag19@gmail.com> wrote:
> Thank you! Noted for future patches — I'll target rtw-next/rtw for
> Realtek drivers. Let me know if you'd like a resend with the corrected
> subject; otherwise happy for it to go in as-is.

No need. Just FYI.


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

* Re: [PATCH v2 wireless] wifi: rtw88: debugfs: don't vzalloc(0) when rsvd_page is read unconfigured
  2026-08-27 13:12 ` [PATCH v2 wireless] " Abdurrahman Karadag
  2026-08-28  0:42   ` Ping-Ke Shih
@ 2026-09-02  3:51   ` Ping-Ke Shih
  1 sibling, 0 replies; 5+ messages in thread
From: Ping-Ke Shih @ 2026-09-02  3:51 UTC (permalink / raw)
  To: Abdurrahman Karadag, linux-wireless
  Cc: pkshih, johannes, kvalo, briannorris, Abdurrahman Karadag

Abdurrahman Karadag <abdurrahmankaradag19@gmail.com> wrote:

> Reading the rsvd_page debugfs entry before writing a page offset and
> count to it calls vzalloc() with a size of zero, because
> rsvd_page.page_num defaults to 0.  vmalloc warns about this:
> 
>   WARNING: mm/vmalloc.c:4019 at __vmalloc_node_range_noprof+0x9ac/0xa30
>   ...
>   Call Trace:
>    __vmalloc_node_noprof+0x4c/0x70
>    rtw_debugfs_get_rsvd_page+0x4c/0x110 [rtw88_core]
>    seq_read_iter+0x132/0x4b0
>    seq_read+0x12e/0x1c0
>    full_proxy_read+0x6f/0xc0
>    vfs_read+0xdd/0x490
> 
> rtw_fw_dump_fifo() would reject the zero size anyway, but only after
> the allocation.  Check for a zero buffer size first and print a short
> usage hint instead of allocating.
> 
> Fixes: e3037485c68e ("rtw88: new Realtek 802.11ac driver")
> Signed-off-by: Abdurrahman Karadag <abdurrahmankaradag19@gmail.com>
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

81510c3d6f21 wifi: rtw88: debugfs: don't vzalloc(0) when rsvd_page is read unconfigured

---
https://github.com/pkshih/rtw.git


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

end of thread, other threads:[~2026-09-02  3:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27 12:48 [PATCH] wifi: rtw88: debugfs: don't vzalloc(0) when rsvd_page is read unconfigured Abdurrahman Karadag
2026-08-27 13:12 ` [PATCH v2 wireless] " Abdurrahman Karadag
2026-08-28  0:42   ` Ping-Ke Shih
     [not found]     ` <CA+tD5P_CN_g6eFzbYW9AvgCDZ8z4dieahFAOScXssC_HY1XDOg@mail.gmail.com>
2026-08-28  9:31       ` Ping-Ke Shih
2026-09-02  3:51   ` Ping-Ke Shih

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