Thread View: linux.kernel.netdev
4 messages
4 total messages
Started by YuanZhe Liu
Wed, 25 Nov 2026 07:16
[PATCH] net: usb: mcs7830: skip zero-length register dump reads
Author: YuanZhe Liu
Date: Wed, 25 Nov 2026 07:16
Date: Wed, 25 Nov 2026 07:16
45 lines
10446 bytes
10446 bytes
mcs7830_get_regs() passes the user-supplied regs->len straight to
mcs7830_get_reg(), which submits a vendor control-IN request for that
many bytes. ETHTOOL_GREGS accepts a zero length, and ethtool_get_regs()
still invokes the driver's get_regs() callback in that case, so a
zero-byte dump request reaches the driver.
A zero-length USB transfer has no data stage and the USB core treats it
as an OUT transfer, so submitting it on usb_rcvctrlpipe() triggers
usb 1-1: BOGUS control dir, pipe 80000380 doesn't match bRequestType c0
WARNING: drivers/usb/core/urb.c:411 at usb_submit_urb
and taints the kernel, which becomes a denial of service when
panic_on_warn is set.
There is nothing to read when regs->len is zero, so return early before
issuing the transfer.
Fixes: 2a36d7083438 ("USB: driver for mcs7830 (aka DeLOCK) USB ethernet adapter")
Cc: stable@vger.kernel.org
Co-developed-by: Bin Yu <byu@xidian.edu.cn>
Signed-off-by: Bin Yu <byu@xidian.edu.cn>
Co-developed-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: Cheng Wen <wencheng@xidian.edu.cn>
Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
---
drivers/net/usb/mcs7830.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index d6698f30218d..f5606f2cea05 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -437,6 +437,8 @@ static void mcs7830_get_regs(struct net_device *net, struct ethtool_regs *regs,
struct usbnet *dev = netdev_priv(net);
regs->version = mcs7830_get_rev(dev);
+ if (!regs->len)
+ return;
mcs7830_get_reg(dev, 0, regs->len, data);
}
--
2.34.1
Re: [PATCH] net: usb: mcs7830: skip zero-length register dump reads
Author: netdev-bot+sinfo
Date: Wed, 25 Nov 2026 07:23
Date: Wed, 25 Nov 2026 07:23
19 lines
8533 bytes
8533 bytes
Hi! This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information: - How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan. Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. *IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages. -- The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Re: [PATCH] net: usb: mcs7830: skip zero-length register dump reads
Author: YuanZhe Liu
Date: Wed, 25 Nov 2026 07:32
Date: Wed, 25 Nov 2026 07:32
12 lines
9599 bytes
9599 bytes
Hi, The issue was found during testing of the driver's ethtool register dump path, not in production or from a bug report. A bound MCS7830 interface and CAP_NET_ADMIN are enough: requesting a zero-length register dump (ETHTOOL_GREGS with regs.len = 0) reaches mcs7830_get_regs() and makes it submit the zero-length vendor control-IN request that triggers the warning. It reproduces every time the ioctl is issued with len = 0. Thanks, YuanZhe Liu
Re: [PATCH] net: usb: mcs7830: skip zero-length register dump reads
Author: Andrew Lunn
Date: Wed, 25 Nov 2026 13:54
Date: Wed, 25 Nov 2026 13:54
17 lines
8757 bytes
8757 bytes
On Wed, Nov 25, 2026 at 03:16:49PM +0800, YuanZhe Liu wrote:
> mcs7830_get_regs() passes the user-supplied regs->len straight to
> mcs7830_get_reg(), which submits a vendor control-IN request for that
> many bytes. ETHTOOL_GREGS accepts a zero length, and ethtool_get_regs()
> still invokes the driver's get_regs() callback in that case, so a
> zero-byte dump request reaches the driver.
Take a step back. Think about the kAPI. Why pass 0?
I think you are solving the problem in the wrong place. And you are
playing whack-a-mole when there is no need.
Andrew
---
pw-bot: cr
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads