Re: [PATCH v2] net: ethtool: do not call get_regs() for zero-length dumps
From: Andrew Lunn
Date: Thu Nov 26 2026 - 09:12:07 EST
> > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> >
> > Who does this bother?
>
> The zero-length request itself is harmless, but it now trips the
> direction check in the USB core and, in setups with panic_on_warn, turns
> a privileged ETHTOOL_GREGS call into a kernel panic. That is the same
> class of issue as the plusb fix (CVE-2023-52742), which also carried a
> Fixes tag and a stable Cc, so I kept both.
Maybe. But how long has it been like this? Nobody has reported it, so
nobody is bothered by it.
Linus has been pushing back on the number of Fixes: which get
submitted. So we have to push back.
> > Some of the kAPIs consider passing 0 as being special. It is user
> > space asking the kernel how big a buffer is needed to hold the full
> > dump. The kernel sets the value in the structure and returns. User
> > space then allocates a buffer of that size, and makes the request
> > again.
> >
> > I don't know if this API actually does this. You need to look at the
> > logic and decide. But by returning this early, if it did, you have
> > broken that.
>
> I checked. ETHTOOL_GREGS has no zero-length size query: the uAPI tells
> users to get the dump size from ETHTOOL_GDRVINFO.regdump_len, ethtool(8)
> does exactly that, and ethtool_get_regs() only clamps a too-large
> regs.len down to get_regs_len(); with regs.len == 0 it does not fill in
> a size. So the early return does not remove a size query; it only stops
> asking the driver for a dump that cannot return any data.
Thanks for checking.
Andrew