Article View: linux.kernel.netdev
Article #22964Re: [PATCH v2] net: ethtool: do not call get_regs() for zero-length dumps
From: YuanZhe Liu
Date: Thu, 26 Nov 2026 08:21
Date: Thu, 26 Nov 2026 08:21
36 lines
10887 bytes
10887 bytes
On Thu, Nov 26, 2026 at 03:58:03AM +0100, Andrew Lunn wrote:
> Your commit message is focusing on USB too much. Very few Ethernet
> drivers are USB. Since you are modifying the core, you should make the
> commit message generic.
Agreed, v3 describes the ethtool side instead of the USB stack.
> 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.
> 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.
v3 to follow separately.
Technical Details
Message-ID:
<20261126082144.3295-1-25031212351@stu.xidian.edu.cn>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371952-linux-kernel-netdev=dewy.ruReferences:
<20261126015239.6038-1-25031212351@stu.xidian.edu.cn> <366216bc-ccc3-4547-8587-87cdf35f552f@lunn.ch>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-371952-linux-kernel-netdev=dewy.ru From: 25031212351@stu.xidian.edu.cn (YuanZhe Liu) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH v2] net: ethtool: do not call get_regs() for zero-length dumps Date: Thu, 26 Nov 2026 16:21:44 +0800 Organization: Usenet Network Message-ID: <20261126082144.3295-1-25031212351@stu.xidian.edu.cn> References: <20261126015239.6038-1-25031212351@stu.xidian.edu.cn> <366216bc-ccc3-4547-8587-87cdf35f552f@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="415970"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:L1sARHlpSWlAyJuK8FxAWYClR88= sha256:v2NwrFFMHKpLN40AjHAK3bFouAZ8AzKHw0WFLIOuDGE= sha1:Sy71bV0fPdI0y9vYVyihgYZSo1k= sha256:GFlm7Mi1B5TmXYWEsg/j2NBpJvAyccR87KOPNyuiu1M= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 3EF33125EB4; Thu, 26 Nov 2026 11:22:30 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.418 X-Spam-Status: No, score=-2.418 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, FROM_LOCAL_DIGITS=0.001, FROM_LOCAL_HEX=0.331, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=neutral reason="invalid (public key: not available)" header.d=stu.xidian.edu.cn X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5wvSP7GV1x91; Thu, 26 Nov 2026 11:22:22 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-371952-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=stu.xidian.edu.cn X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 7B026125EB1; Thu, 26 Nov 2026 11:22:13 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 26B5442666; Thu, 26 Nov 2026 08:22:10 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795681328; b=QbZ4bh+fPPmJd249qlnqf/je3l8lbU70BXxOQB4DEkvou12npZL14dUXDXjCZ7CkeVJx 276D7V5VCSgWquFM3CCoXZ1WWXKQvyVgMMuABgQWaIVf+cfTErsM2UGsKgncrowskanny GkwPWCAI2hdhGgpblJ3MXar3VLY4QuokrzAmygiOKWY5/m+P5JQf0LuTPzX6THk7xjTQb oDZ8Uz18PQFLFSWXuSrarsgbq6oawkUDQR6Ta/V0br4MDGzsevgl01QAHU4gu2vsWlsoy XADu/r60D3UjG5bqTm43STk5DkWle35en8DSbw4Qep1Vu5SZwgWwquHLfa7Yyjf0ifQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795681328; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To: Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:References: X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version:Content-Type: Content-Transfer-Encoding:X-CM-TRANSID:X-Coremail-Antispam: X-CM-SenderInfo; bh=FmikAp2+qSipaQtzAupGaAipdwzh2wlO7XfeF8y0Ows=; b=rlbw6MRx8eysGulqvwqVSMVTxsND1posL7KHc1RPsF+kEh2UxAKjBLyFsBCIGEO2rkHh 8fj59H2JkhpKl05lO1m+Q4rRrmgXml5tLgsK8FLslFCgrp8U/RDfw7Q3kDX0NrtBw09QY Jm6gp9dzPvIfGAzoaoTnYHsYzhR8Xrv7dURMABDyd8yU9vPwoom4v2ajQzJF0EgL7WlkZ KJ72OTP8xFNhyY4ATWjt5GX3HNwATTz2EFArhnkMB9oi8v1lAelY/AB79/5mcRAchtcWG +AgcV1W01OrElnDINbSnpDRbyHKNW5H83mX+fwcLAGjrycENMY6NgS9DqWMxs80T/Zg== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=stu.xidian.edu.cn; spf=pass smtp.mailfrom=stu.xidian.edu.cn; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CF812606A68C; Thu, 26 Nov 2026 08:22:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=162.243.164.118 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795681328; b=L/wB+veZCytprEaVYy7gSws50QhRx1pjEG8GvoGCiML3r7P8YmTwPmODZhhrLQ0LS8WV Wft5tiK9ZFLIa6UlkOl0BXAvqNEc7YxIuIkjM1D1NiAfganKWwlG9RYdE7yJXeXg8kFPP BXH+/kem3HGkVx1t1IteDTfYilvFc18flOxHqBvotoLNrsHKrA6QY7McAKtfDo7m0jnEn u1ofh0O787jGocIPaM39LUY+d2TD4WZAK/OCJpQxQd/A2LwG4Hdr1hP3YeDEjLqpckb9L Dfwqewjm3ja7gGABbjnlYsh5i1MyXVjGNvWkLjFbGTmwGThw9qgal2A4Ga+VY/dWsNg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795681328; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:Date: Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding:X-CM-TRANSID:X-Coremail-Antispam: X-CM-SenderInfo; bh=FmikAp2+qSipaQtzAupGaAipdwzh2wlO7XfeF8y0Ows=; b=OGs2g8hwkCyNX5mwEJCxkjYAjxSXiZh4A5JbQqefUyoowd/h56KMUAzYqx+9GBargfaj ZTK4CY2vWkoJ7lgVIsUk5eSgC4EbWJAha9TvNtEwqoTRJp8tZ00Vx2Upa0m8Lm+K3ZR1P pWlitHW5oMWmZd9GQLW76VFXBKkFcMMJTFfJNpytcjnNfG2cVgA+odgEkLOpoctkL0Fi6 P+QENkECpm8JyGogqaW1Z/SjXYDcB1JMX71dnk5eYAk4dig6iYSpyTeCb/oC3mKhdwVzW CjKXqXoUetCTX3tLktdzvgvAGrjiI5dYutEhF/PrYQsJkf5IVejdSX1ERHJQvEWp9rQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=stu.xidian.edu.cn; spf=pass smtp.mailfrom=stu.xidian.edu.cn; arc=none smtp.remote-ip=162.243.164.118 X-Received: from zg8tmtyylji0my4xnjqumte4.icoremail.net (zg8tmtyylji0my4xnjqumte4.icoremail.net [162.243.164.118]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6089B606A337; Thu, 26 Nov 2026 08:22:03 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 6089B606A337 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=stu.xidian.edu.cn X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=stu.xidian.edu.cn X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=stu.xidian.edu.cn; s=dkim; h=Received:From:To:Cc:Subject:Date: Message-Id:In-Reply-To:References:MIME-Version:Content-Type: Content-Transfer-Encoding; bh=FmikAp2+qSipaQtzAupGaAipdwzh2wlO7X feF8y0Ows=; b=ZhkdlZ5jSMyjBAAWc+ZccNR6LIwwWKa1eTDCtK+UNMFcSrL+hk 0JaMk2b//3M6fFt/jFtVd0oFe/OY88Q7MxRqBKq+cGthmlKxPeoZBO49985GwvQA BPUDIYTsIRCUfaShGKnoAtJ0/sD5xD6zVgxU0mcTNp8J8l98APp4NlZ5o= X-Received: from user-virtual-machine.localdomain (unknown [113.200.174.43]) by hzbj-edu-front-2.icoremail.net (Coremail) with UTF8SMTPA id BLQMCkCm6wAZ7Adrf+JAAg--.50063S2; Thu, 26 Nov 2026 16:21:46 +0800 (CST) X-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> X-Mailer: git-send-email 2.34.1 X-In-Reply-To: <366216bc-ccc3-4547-8587-87cdf35f552f@lunn.ch> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list X-CM-TRANSID: BLQMCkCm6wAZ7Adrf+JAAg--.50063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