From: Callan Huang <luvings@qq.com>
To: johannes@sipsolutions.net
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
luvings@qq.com
Subject: [PATCH v1] wifi: wext: propagate metadata on -E2BIG for GET ioctls
Date: Thu, 7 Aug 2025 21:10:18 +0800 [thread overview]
Message-ID: <tencent_FE21EA217C7FF6B3CEAB5749F98F0267EC0A@qq.com> (raw)
When GET ioctls encounter insufficient buffer (-E2BIG),
preserve u.data.length metadata in iwreq structure for size detection
Typical usage in userspace tools like 'iwlist wlan0 scanning':
- Detect required buffer size via u.data.length
- Implement retry logic with proper allocation
Signed-off-by: Callan Huang <luvings@qq.com>
---
net/wireless/wext-core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/wireless/wext-core.c b/net/wireless/wext-core.c
index c32a7c690..b4f72a49f 100644
--- a/net/wireless/wext-core.c
+++ b/net/wireless/wext-core.c
@@ -1075,7 +1075,7 @@ int wext_handle_ioctl(struct net *net, unsigned int cmd, void __user *arg)
ret = wext_ioctl_dispatch(net, &iwr, cmd, &info,
ioctl_standard_call,
ioctl_private_call);
- if (ret >= 0 &&
+ if ((ret >= 0 || ret == -E2BIG) &&
IW_IS_GET(cmd) &&
copy_to_user(arg, &iwr, sizeof(struct iwreq)))
return -EFAULT;
@@ -1138,7 +1138,7 @@ int compat_wext_handle_ioctl(struct net *net, unsigned int cmd,
compat_standard_call,
compat_private_call);
- if (ret >= 0 &&
+ if ((ret >= 0 || ret == -E2BIG) &&
IW_IS_GET(cmd) &&
copy_to_user(argp, &iwr, sizeof(struct iwreq)))
return -EFAULT;
--
2.25.1
next reply other threads:[~2025-08-07 13:16 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 13:10 Callan Huang [this message]
2025-08-25 7:33 ` Johannes Berg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=tencent_FE21EA217C7FF6B3CEAB5749F98F0267EC0A@qq.com \
--to=luvings@qq.com \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®