Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: YuanZhe Liu <25031212351@stu.xidian.edu.cn>
Cc: Jakub Kicinski <kuba@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Paolo Abeni <pabeni@redhat.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Simon Horman <horms@kernel.org>,
	Bin Yu <byu@xidian.edu.cn>, Cheng Wen <wencheng@xidian.edu.cn>
Subject: Re: [PATCH v2] net: ethtool: do not call get_regs() for zero-length dumps
Date: Thu, 26 Nov 2026 15:11:55 +0100	[thread overview]
Message-ID: <5e76388e-e88a-4256-9324-aff0c9625aba@lunn.ch> (raw)
In-Reply-To: <20261126082144.3295-1-25031212351@stu.xidian.edu.cn>

> > 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

      reply	other threads:[~2026-11-26 14:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  1:52 [PATCH v2] net: ethtool: do not call get_regs() for zero-length dumps YuanZhe Liu
2026-11-26  2:58 ` Andrew Lunn
2026-11-26  8:21   ` YuanZhe Liu
2026-11-26 14:11     ` Andrew Lunn [this message]

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=5e76388e-e88a-4256-9324-aff0c9625aba@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=25031212351@stu.xidian.edu.cn \
    --cc=byu@xidian.edu.cn \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=wencheng@xidian.edu.cn \
    /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