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 and its `Fixes: 830877d89edc` tag present this
patch as a fix for a live defect: an odd `data_len` drops the last…
--
net: phy: as21xxx: Reject odd IPC payload lengths
This patch adds a check to aeon_ipc_send_msg() that rejects payload
lengths that are not a multiple of the 16-bit IPC data register width.
The commit message says an odd length drops the last byte and that the
firmware then reads stale register contents. The patch carries a Fixes:
tag for the original driver commit.
> The IPC payload is transferred through 16-bit data registers, but
> aeon_ipc_send_msg() advertises data_len bytes to the firmware while
> writing only data_len / 2 registers. For an odd length the last byte is
> silently dropped, and the firmware reads whatever was left in the next
> register.
>
> Reject payload lengths that are not a multiple of the register width.
>
> Fixes: 830877d89edc ("net: phy: Add support for Aeonsemi AS21xxx PHYs")
[Severity: Low]
Can any in-tree caller actually pass an odd data_len to
aeon_ipc_send_msg()?
The function is static in drivers/net/phy/as21xxx.c. Every caller passes
sizeof() of a local u16 array, so data_len is always even:
drivers/net/phy/as21xxx.c:aeon_ipc_get_fw_version() {
u16 ret_data[AEON_IPC_DATA_NUM_REGISTERS], data[1];
...
ret = aeon_ipc_send_msg(phydev, IPC_CMD_INFO, data,
sizeof(data), ret_data);
...
}
drivers/net/phy/as21xxx.c:aeon_dpc_ra_enable() {
u16 data[2];
...
return aeon_ipc_send_msg(phydev, IPC_CMD_CFG_PARAM, data,
sizeof(data), NULL);
}
The callers added later in the series also pass even lengths.
aeon_restart_aneg() uses u16 data[3], which is 6 bytes, and
aeon_set_top_speed() uses u16 data[4], which is 8 bytes.
So the new check never fires on any current path. It looks like
hardening against future misuse rather than a fix for a reachable bug.
Could the commit message say that no existing caller is affected? Should
the Fixes: tag be dropped so this isn't picked up for stable as a bug
fix?
The commit message also doesn't say why odd lengths are rejected instead
of rounded up. The receive path in the same function accepts an odd byte
count and rounds up:
for (i = 0; i < DIV_ROUND_UP(ret_size, sizeof(u16)); i++) {
Could the commit message explain why the send side rejects odd lengths
instead?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/2026…%40collabora.com