linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH wireless-next] wifi: cfg80211: Increase netlink buffer size to 4096 bytes in nl80211_get_station()
@ 2025-08-22  5:02 Sarika Sharma
  2025-08-25  8:11 ` Johannes Berg
  0 siblings, 1 reply; 4+ messages in thread
From: Sarika Sharma @ 2025-08-22  5:02 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Sarika Sharma

Currently, the buffer size allocated for the get_station command in
nl80211_get_station is NLMSG_DEFAULT_SIZE, which, in some cases, is
insufficient to send complete output to user space and results in
"no buffer space available" error. This is especially evident in
setups with 3 links, where the amount of station info exceeds the
default allocation, leading to underflows and incomplete netlink
messages.

To fix this, increase the buffer size to 4096 bytes. This ensures
that the nl80211_get_station() command can return complete station
information for up to 3 links without allocation failure.

Fixes: 82d7f841d9bd ("wifi: cfg80211: extend to embed link level statistics in NL message")
Signed-off-by: Sarika Sharma <quic_sarishar@quicinc.com>
---
While this static increase is a practical short-term solution, it is
not scalable for configurations with more than 3 links. To address
this, planning to introduce a mechanism where user space can
optionally pass a specific link ID to request link-level statistics.
If no link ID is provided, only MLD-level (Multi-Link devices)
statistics will be returned. If user space requires data for
multiple links, it can invoke the get_station command multiple times,
each time specifying a different link ID. This approach keeps
individual message sizes manageable, avoids excessive memory
allocation, and provides fine-grained control over the data retrieved.
---
 net/wireless/nl80211.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 89519aa52893..042cfff78bb3 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -7624,7 +7624,7 @@ static int nl80211_get_station(struct sk_buff *skb, struct genl_info *info)
 		return err;
 	}
 
-	msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
+	msg = nlmsg_new(4096, GFP_KERNEL);
 	if (!msg) {
 		cfg80211_sinfo_release_content(&sinfo);
 		return -ENOMEM;

base-commit: d9104cec3e8fe4b458b74709853231385779001f
-- 
2.34.1


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

end of thread, other threads:[~2025-09-03  8:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-22  5:02 [PATCH wireless-next] wifi: cfg80211: Increase netlink buffer size to 4096 bytes in nl80211_get_station() Sarika Sharma
2025-08-25  8:11 ` Johannes Berg
2025-08-28 10:53   ` Nithyanantham Paramasivam
2025-09-03  8:48     ` Nithyanantham Paramasivam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).