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/2026…%40collabora.com