๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24895

Re: [PATCH net 07/14] net: phy: as21xxx: Write IPC payload under ipc_lock

#24895
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 01:50
71 lines
10413 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message describes a race that cannot happen on any
  current path.

--

net: phy: as21xxx: Write IPC payload under ipc_lock

This patch moves mutex_lock(&priv->ipc_lock) in aeon_ipc_send_msg() above
the loop that writes the VEND1_IPC_DATA registers. The payload writes and
the command issue are then covered by the same critical section. The
argument checks stay outside the lock.

> aeon_ipc_send_msg() writes the message payload to the shared
> VEND1_IPC_DATA registers before taking ipc_lock.  Two concurrent
> senders may interleave, so that one overwrites the payload of the
> other before the corresponding command is issued.  The firmware would
> then execute a command with the wrong arguments.

[ ... ]

> Fixes: 830877d89edc ("net: phy: Add support for Aeonsemi AS21xxx PHYs")

[Severity: Low]
Can two senders actually overlap on any current path?

In drivers/net/phy/as21xxx.c, aeon_ipc_send_msg() has only two callers:
aeon_ipc_get_fw_version() and aeon_dpc_ra_enable(). as21xxx_probe() calls
them one after the other, on the same thread:

as21xxx_probe() {
    ...
	ret = aeon_ipc_get_fw_version(phydev);
    ...
	return aeon_dpc_ra_enable(phydev);
}

That same probe allocates priv and priv->ipc_lock for each phydev, and the
driver core serializes probe of a device.

The only other IPC user is as21xxx_match_phy_device(). It uses its own
temporary priv and mutex, sends only zero-length NOOPs and never writes
VEND1_IPC_DATA. It also runs before probe.

The later patch in this series, "net: phy: as21xxx: Configure autoneg
advertisement via IPC", adds runtime senders from as21xxx_config_aneg():
aeon_set_top_speed() and aeon_restart_aneg(). Those paths already hold
phydev->lock:

- _phy_start_aneg() has lockdep_assert_held(&phydev->lock).
- phy_speed_down() and phy_speed_up() take phydev->lock around
  phy_config_aneg().

The code change looks fine as hardening, because the lock now covers the
whole transaction.

Could the commit message describe this as hardening, or as preparation for
future runtime IPC users, rather than as a fix for a firmware
misconfiguration that can't currently happen?

Should the Fixes: tag also be dropped, so this isn't picked up for net and
stable as a bug fix?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc%40collabora.com
Technical Details
Message-ID: <179608985454.3146.10885911079866736742@kernel.org>
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-374616-linux-kernel-netdev=dewy.ru
References: <20261130-as21xxx-fixes-v1-7-1bd2eae6ccbc@collabora.com>

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-374616-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net 07/14] net: phy: as21xxx: Write IPC payload under ipc_lock
Date: Tue, 01 Dec 2026 01:50:54 +0000
Organization: Usenet Network
Message-ID: <179608985454.3146.10885911079866736742@kernel.org>
References: <20261130-as21xxx-fixes-v1-7-1bd2eae6ccbc@collabora.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1586869"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:RIfBjn5y1HiN4S1Iu6Q7c+5QEyo= sha256:D+HCxcgVl5affY7fBa1jC+slg4Q7Y91azwZmZB/Ohzw=
	sha1:kB2OTqx0ilvhBe+Vm3FzFihc8xs= sha256:5poq16qddBtdnEl3lgChzn1QpIc5whWmoljOjNoRhNg=
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 4C2EB1171BE; Tue,  1 Dec 2026 04:51:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, 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 (2048-bit key)
	header.d=kernel.org
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 AH1Ba_FtO55D;
	Tue,  1 Dec 2026 04:51:14 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374616-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id BDBCD1171EF; Tue,  1 Dec 2026 04:51:02 +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 5653926810; Tue,  1 Dec 2026 01:50:59 +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=1796089856;
	b=wjfs+ujwNtCCFZcTOqlBwFSUhLsE0cVGuKKnFZ+0BL4awiVPw4zYnF1zFR7VQEYQQwG3
	 QGq/PzmzaYwnp0yOGz/N8UkySVHstiZl90KIga8l92hIkQoWdgGLIHQxcNo+svcHFMVzA
	 FpjspS6F/ybqM0spjyaHSWCvgksD/Ow+mB/6P0Of5imZ3uyhGZNDr5PqrRb0K1wsE/Nqz
	 4VR8RiYSzfFmfdva6oYx66lpA26mbikV21qBGAaQElqTN6Z0nsngziVUr2qJPdXy9Yf54
	 4I5leM9vjJMNJ30Pa0dkLimJHDLu+cIHVa8NjL37z5PyprkyUrgLH8MPN4ukYcKS5gw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796089856;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=ZBM9gpcKXcfc3Smm/RZ0+h+4GF0oJSilG0a1K9u3KYU=;
	b=mAwDvrKdoJ+7nASJD5xyRBuBGcaum8CflrfeieRF+iwXQk8moKdTcNCTFDeBui6GFm48
	 3Wm8JnRO6Hyb5kip6Q2ErdAoMqRxpof2UYjwi4WfyVbd4CX8eDLucNZDdvVZhBpiczmBJ
	 K3XeBI0NkjUVB5kwXXYr1HSv0Q/JOXp86i5CfjRCU3FdzJOi2Gb/5l8cs1/8B0AwMt4VY
	 qxwLAuc3FcawlRUTtK/0Svj8RWx8BL43Kzok85cwDkvXwZCzQlC4IT6hWllfqcJqzW8fU
	 qZlIyIHvYCl7R00Pl0Xm7SEch4BhVY6dLytdv2Vf21YbYJC0y2l6PURASL41BdqhX4A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gaVOGwgF;
	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 C27E4606A329;
	Tue,  1 Dec 2026 01:50:56 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gaVOGwgF
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796089856;
	b=hTARPjcNfUhIWiJcYPxqazr3+den/zqeD0yWPcHO52+rYTbHCcABDecmTfIyct5zVeX/
	 IJ/FgwLA5o+hpwZBQ8bJ8h+dg2JHpYQ2sq5hKZNhsfiGReU4f1QkAnVW02RFALM2tMDoG
	 w7JVe9T280/OhYA7rosHgzjPcAoZKWOF52yiyDNWAD12EBaSGJqo6XmHg5yLPQPk+nQ8q
	 mlgpI2wV250oP95zTIBcziHdpXXWcnOtltlWe7CuLOefC23//UgM8taZ7fWZ6/t2r6sZx
	 9jaTjHUkaxdk3tJY68mtX27fikyDtQjrl0yePciefcBpF4sKffQl1svTNc01HtbVisA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796089856;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=ZBM9gpcKXcfc3Smm/RZ0+h+4GF0oJSilG0a1K9u3KYU=;
	b=V+Z/JdTqUE5+1x0LdwANd8fGxoFy3T3EEkhQvMZNegCrEJaFXLJeoTWeRdnkuP9hRops
	 FFKLjq76JgpmILLll61xxYWPO5CfAzboiDfhwlhHgFDVehgjyCLkTGnNPuVlRR34FgM9n
	 5fQ68no0mY7uMDSfyfLeNE8DYA5JoT3YwSQzEtgxYf6oZhWV3q4Oyvfrbn2oQ/2voiwam
	 N1Df+b47ivHjtzU9WASsAY4PaUfKXQQUnX4mO2gYxBqqz0FvzxJYgYwsW5AxuExD+O6ea
	 LONbx4Lngk1adxJjNrKSxP4IimXQ5M/53n1m6V8CBBNA8pybM0ki0bJixs0kVahgTkQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=gaVOGwgF;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id E327D606A339
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 01:50:55 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 02CEC1F00893;
	Tue,  1 Dec 2026 01:50:54 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796089855;
	bh=ZBM9gpcKXcfc3Smm/RZ0+h+4GF0oJSilG0a1K9u3KYU=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=gaVOGwgFdUWfVYSSkAbbxAdWzSOnb/osg6J+W3Ru6/olT7DpxpxdkFJDRHNDpM/bW
	 Tvwyv+Xd3+R9fzx3eL4Y1M+4KX5h45VqKWNsr8Vl4XXwS2yTOkCSZBStgzudpEcyOw
	 rBEHrWC/mVw9WNxIizSKD6W29JH1K0Avk0gAnvzQlttgqVKBStCRAHMjG2SnvTugy7
	 1KvyuW87EsCViKwKWHaHpGnlBD12xXBhV3JJokTYw2IsGJsqM+SKuXvwUoop3gpSuE
	 FXG/b41DSG4SAxht7qQFUYaxbKLq1J/rQTEq/IWldr1EUk13H8yfkrXMlaGBOlN31F
	 msIEe5Ur3pAkw==
X-Cc: ansuelsmth@gmail.com, andrew@lunn.ch, hkallweit1@gmail.com,
 linux@armlinux.org.uk, davem@davemloft.net, edumazet@kernel.org,
 kuba@kernel.org, pabeni@redhat.com, kernel@collabora.com,
 netdev@vger.kernel.org
X-In-Reply-To: <20261130-as21xxx-fixes-v1-7-1bd2eae6ccbc@collabora.com>
X-sashiko-severity: Low
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