Article View: linux.kernel.netdev
Article #5217Re: [PATCH net v4 1/2] net: usb: lan78xx: do not update statistics after a failed read
From: Andrew Lunn
Date: Tue, 20 Oct 2026 00:36
Date: Tue, 20 Oct 2026 00:36
26 lines
9446 bytes
9446 bytes
On Tue, Oct 20, 2026 at 08:16:20AM +0800, Wei Jie Law wrote:
> lan78xx_update_stats() reads the hardware counters into an on-stack
> struct lan78xx_statstage. If lan78xx_read_stats() fails, only the
> rollover check is skipped: the counters are still recomputed from the
> uninitialized stack buffer and stored in dev->stats.curr_stat, which is
> then reported to user space by ethtool -S.
>
> Keep the previous values when the read fails.
>
> Found by code review with LLM assistance. Tested together with the next
> patch, which makes short reads fail: with an emulated device, ethtool -S
> then keeps reporting the previous counters.
>
> Fixes: 20ff55655a93 ("lan78xx: handle statistics counter rollover")
> Cc: stable@vger.kernel.org
> Assisted-by: LLM
> Signed-off-by: Wei Jie Law <law.wei.jie@gt.tech.gov.sg>
net-next please.
https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Andrew
Technical Details
Message-ID:
<4080c576-e612-4192-965e-4df444f65b62@lunn.ch>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348938-linux-kernel-netdev=dewy.ruReferences:
<20261020001621.2920-1-law.wei.jie@gt.tech.gov.sg> <20261020001621.2920-2-law.wei.jie@gt.tech.gov.sg>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-348938-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net v4 1/2] net: usb: lan78xx: do not update statistics after a failed read Date: Tue, 20 Oct 2026 02:36:16 +0200 Organization: Usenet Network Message-ID: <4080c576-e612-4192-965e-4df444f65b62@lunn.ch> References: <20261020001621.2920-1-law.wei.jie@gt.tech.gov.sg> <20261020001621.2920-2-law.wei.jie@gt.tech.gov.sg> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3750765"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:BH96tjz3+/UXjnfGDzgEJ705dOk= sha256:t6ex3IdbSrU4uhjftkGK/oDo9ElHdzlb8QxVm/QQT+Q= sha1:rLBDNz2tyR9QFUhmZAG0NPEFMqo= sha256:YAvnyzfgnQJj3V7Yh4Fyb0GUvHKJz2myo/FUnEvVDHg= Content-Disposition: inline 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 8DAF3110B96; Tue, 20 Oct 2026 03:37:38 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.049 X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.25, 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=pass (1024-bit key) header.d=lunn.ch 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 pYCMpiDP5FUS; Tue, 20 Oct 2026 03:37:35 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-348938-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id B2404110B7A; Tue, 20 Oct 2026 03:37:26 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 534F13CA94; Tue, 20 Oct 2026 00:36:40 +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=1792456597; b=R9/wix1nWEOZGoPyBAMJHNTFYjB0DLxVWzFnWN4qFAgg6Ltt369Gt0UULGF3BhMsBZye TXPmDK/vsytkIbS28KeUkbUyYvm4UW3ip+DS1Oh1tLdNprjfycfR/Ko0m0UvpCZvRb1pQ CS9biHapZsAn5zqVU5txykOFg9M/Hgxx46eNXY0oxdi/H7VXHlfLCNsXjK3GS7XHo1XWy G+O4zvQfvR5vltn0udMKzSjabeuw7i7+qx5yEJKeost+g3oaIL4qL/8pM7Ed9S4q07JQ6 O5GgEpVb1q6UbwR4vQ4xr98hncpXAPZcNhg9JcJWtq5sW5VkWwpnoncGCQdPuoKeWWg== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792456597; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=FjcL9AJZ4sENmxXqjg42oyqtitz2pn6fc7a0N6UMUyI=; b=DnFeI94J9UCnSVlNhVHyY5Z0nzOIHh3M/L07vp+n7lvwFf1lp/a4o00lwRGRgfifSeuY 3FKqwPHzfrVG5uZFzgkzFMOvoGnPT9NBgJw3DMfCYUZPVxcvYv09TEbo2d0ZDzrKmOmR+ +AkY0kuNt1FLllG26ERN+UN3tDvvLWITP5sqkkZsw3EsROwhYWZK2ktp0H8Gb+e6XF5bZ tcrBiYTKzdihRua6Ya2BNr4PedIorJVFw70g21IOAhnUTNxq6xwKn2u4FPOeytxpGL4b4 kF6jx6AFAxicnAcsZBDAHxH8p8osfrMJaop58R70L1sB4ZjYrOlQUKjtvWIx9KLvqCw== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=klvaBI4N; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; 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 8D7C1606A319; Tue, 20 Oct 2026 00:36:37 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=klvaBI4N X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1792456591; b=QjNtWMbIvnO915Rj3SZB4bSfFk7C7+CzFPCJMrxFvBk1pwd3BaEmRbr1yrrAn6MzY3N3 Wvgkt6BdhjhOImtothx+3ZBzfJ2nmM1DLgUmx35cxHuoBGGtr09Z5o1UWr8zn29e2LYhs QYhKOD5W1cqFp4TzUndqqgPCa8/XZ6t45iYuA9lOrXaxq2BroLc7deuLoOxKXfz9qYuZs +cx+OoJlV2TOj04/9YnGGmoVoLLhyu9tZ+i1bhnojG1x6SLr/av+cirIZPQqhxAcvtmmd KcxPtGKgoJnfgfMRprYb6HOTfU7s7EQczReCmAHSPb8n4ZJ/0XubH4JLM+4A5uQAecQ== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1792456591; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=FjcL9AJZ4sENmxXqjg42oyqtitz2pn6fc7a0N6UMUyI=; b=AOGYYSLHmoo4AOfa+uu2nw1j9oLrhKAahRZAL6LUsLPVYSfh7lj49r72tTtJTrJKo1IM a2mt9aYHipZSrUQ9SHG2bMdx71oBhXK9MrZlYP8vCXDdJ/18pXI+w/g+Ani8F2noXxnGX HzZj+KF9absgA4lrTf/wCoAv6eze2rt/Wt3pF7yDMi3J2yhPVNvxx9TdwX/20fow2/AA7 VKNdPHyp93g4kXeZU//nDpQw+sngJUHDi81PdlR4I4YYOBdekd2Nc2AviS8H6wqwgJDHd LRq3YRJmNlZGQL5qEljnueXOHoH79QjpXzEkzPoa6u1cTcMYpz6i4eI9UGQPXeyE8zA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=klvaBI4N; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1CCB0606A331; Tue, 20 Oct 2026 00:36:30 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1CCB0606A331 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=FjcL9AJZ4sENmxXqjg42oyqtitz2pn6fc7a0N6UMUyI=; b=klvaBI4N5Mhh8DjOhAKZsaSE9g 7vYvd9Odn0GCqO/ednu0lxXh52iEFcCqIPxBBXk2/xAr7lkgxGtQn7zG0ACbdD3uoKS+bMWh2aaGo 9tiOT6H7Xqb5C381/5wPgxbs9lJrDegQyJZARXhPOKup3lrClaDrXnsjenw9fO41zu8Q=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xIxpw-00BjO7-4e; Tue, 20 Oct 2026 02:36:16 +0200 X-Cc: Thangaraj Samynathan <Thangaraj.S@microchip.com>, UNGLinuxDriver@microchip.com, Andrew Lunn <andrew+netdev@lunn.ch>, "David S . Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, Woojung Huh <woojung.huh@microchip.com>, netdev@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Jie Law <98lawweijie@gmail.com>, stable@vger.kernel.org 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-In-Reply-To: <20261020001621.2920-2-law.wei.jie@gt.tech.gov.sg>