All of lore.kernel.org
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: cristian.ciocaltea@collabora.com
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
Subject: Re: [PATCH net 06/14] net: phy: as21xxx: Do not write the IPC reply to a NULL buffer
Date: Tue, 01 Dec 2026 01:50:53 +0000	[thread overview]
Message-ID: <179608985322.3146.13966944393588293000@kernel.org> (raw)
In-Reply-To: <20261130-as21xxx-fixes-v1-6-1bd2eae6ccbc@collabora.com>

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 the NULL write in
  aeon_ipc_send_msg() as hypothetical: "A caller supplying a payload but…
- [Low] The comment above aeon_ipc_send_msg()
  (drivers/net/phy/as21xxx.c:453-456) still bases the return value on…

--

net: phy: as21xxx: Do not write the IPC reply to a NULL buffer

This commit changes aeon_ipc_send_msg() to decide whether to read the IPC
reply based on ret_data instead of data. This avoids writing the reply
through a NULL buffer. It also rejects a NULL data pointer with a non-zero
data_len when the function is entered.

> aeon_ipc_send_msg() intends to skip reading the IPC reply when the
> caller passes no buffer for it, but the check tests the input buffer
> (data) rather than the output buffer (ret_data).  A caller supplying
> a payload but a NULL ret_data would have the reply written through a
> NULL pointer.

[Severity: Low]
This isn't a bug, but the description makes this case sound hypothetical.
Doesn't an in-tree caller already hit it on every probe?

drivers/net/phy/as21xxx.c:aeon_dpc_ra_enable() {
    ...
	return aeon_ipc_send_msg(phydev, IPC_CMD_CFG_PARAM, data,
				 sizeof(data), NULL);
}

and as21xxx_probe() ends with:

	return aeon_dpc_ra_enable(phydev);

So as21xxx_probe()->aeon_dpc_ra_enable()->aeon_ipc_send_msg() passes a
non-NULL data and a NULL ret_data. The old "if (!data)" check does not
fire for this call. If the firmware reports a non-zero AEON_IPC_STS_SIZE
for CFG_PARAM, the reply loop does ret_data[i] = ret through NULL during
probe.

The guard and this caller both came in with 830877d89edc, so the Fixes
tag looks right.

The commit message also leaves out a behaviour change. Before this patch,
a reply size above AEON_IPC_DATA_MAX made aeon_dpc_ra_enable() return
-EINVAL, so probe failed. With this patch, the size is not checked when
ret_data is NULL, so probe succeeds.

Could the commit message name aeon_dpc_ra_enable() as the affected
probe-time caller and mention this change, to help stable backporters?

> diff --git a/drivers/net/phy/as21xxx.c b/drivers/net/phy/as21xxx.c
> index 8d46fdfc279a7..592b4b7a78692 100644
> --- a/drivers/net/phy/as21xxx.c
> +++ b/drivers/net/phy/as21xxx.c

[ ... ]

> @@ -486,14 +489,14 @@ static int aeon_ipc_send_msg(struct phy_device *phydev,
>  		goto out;
>  	}
>  
> -	if (!data)
> -		goto out;
> -
>  	if ((ret_sts & AEON_IPC_STS_STATUS) == AEON_IPC_STS_STATUS_ERROR) {
>  		ret = -EINVAL;
>  		goto out;
>  	}
>  
> +	if (!ret_data)
> +		goto out;
> +

[Severity: Low]
Should the comment above aeon_ipc_send_msg() be updated as well? It still
bases the return value on data:

/* If data is NULL, return 0 or negative error.
 * If data not NULL, return number of Bytes received from IPC or
 * a negative error.
 */

After this change, a call with a non-NULL data and a NULL ret_data returns
0 on success, not a byte count.

aeon_dpc_ra_enable() is one such caller. Later in the series, "net: phy:
as21xxx: Configure autoneg advertisement via IPC" adds two CFG_PARAM/CU_AN
helpers that make the same kind of call. All three return the result
directly and rely on 0 meaning success.

The comment is still unchanged at the end of the series. Could it refer to
ret_data instead?

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc%40collabora.com

  parent reply	other threads:[~2026-12-01  1:50 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  0:55 [PATCH net 00/14] net: phy: as21xxx: Fix a batch of driver issues Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 01/14] net: phy: as21xxx: handle stale link status during autoneg Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 02/14] net: phy: as21xxx: handle odd firmware on loading Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 03/14] net: phy: as21xxx: Fix LED index bounds check Cristian Ciocaltea
2026-11-30  2:37   ` Andrew Lunn
2026-11-30 10:35     ` Cristian Ciocaltea
2026-11-30  0:55 ` [PATCH net 04/14] net: phy: as21xxx: Use the correct mask for the speed status Cristian Ciocaltea
2026-11-30  2:39   ` Andrew Lunn
2026-11-30  0:55 ` [PATCH net 05/14] net: phy: as21xxx: Correct the 10M speed status value Cristian Ciocaltea
2026-11-30  2:40   ` Andrew Lunn
2026-12-01  1:50   ` netdev-bot+sashiko
2026-11-30  0:55 ` [PATCH net 06/14] net: phy: as21xxx: Do not write the IPC reply to a NULL buffer Cristian Ciocaltea
2026-11-30  2:49   ` Andrew Lunn
2026-11-30 10:53     ` Cristian Ciocaltea
2026-12-01  1:50   ` netdev-bot+sashiko [this message]
2026-11-30  0:55 ` [PATCH net 07/14] net: phy: as21xxx: Write IPC payload under ipc_lock Cristian Ciocaltea
2026-11-30  2:53   ` Andrew Lunn
2026-11-30 11:09     ` Cristian Ciocaltea
2026-12-01  1:50   ` netdev-bot+sashiko
2026-11-30  0:55 ` [PATCH net 08/14] net: phy: as21xxx: Handle IPC payload write errors Cristian Ciocaltea
2026-11-30  2:54   ` Andrew Lunn
2026-11-30  0:55 ` [PATCH net 09/14] net: phy: as21xxx: Reject odd IPC payload lengths Cristian Ciocaltea
2026-11-30  2:55   ` Andrew Lunn
2026-12-01  1:50   ` netdev-bot+sashiko
2026-11-30  0:55 ` [PATCH net 10/14] net: phy: as21xxx: Fix LED hw control set for unsupported rules Cristian Ciocaltea
2026-11-30  3:01   ` Andrew Lunn
2026-11-30 11:29     ` Cristian Ciocaltea
2026-11-30 13:37       ` Andrew Lunn
2026-12-01  1:50   ` netdev-bot+sashiko
2026-11-30  0:55 ` [PATCH net 11/14] net: phy: as21xxx: Read 10/100/1000 link modes from C22 advertisement Cristian Ciocaltea
2026-11-30  3:34   ` Andrew Lunn
2026-11-30 11:53     ` Cristian Ciocaltea
2026-11-30 13:39       ` Andrew Lunn
2026-12-01  1:50   ` netdev-bot+sashiko
2026-11-30  0:55 ` [PATCH net 12/14] net: phy: as21xxx: Configure autoneg advertisement via IPC Cristian Ciocaltea
2026-11-30  3:43   ` Andrew Lunn
2026-11-30 12:05     ` Cristian Ciocaltea
2026-12-01  1:50   ` netdev-bot+sashiko
2026-11-30  0:55 ` [PATCH net 13/14] net: phy: as21xxx: Fix speed and duplex reporting Cristian Ciocaltea
2026-11-30  3:50   ` Andrew Lunn
2026-11-30 12:21     ` Cristian Ciocaltea
2026-11-30 14:01       ` Andrew Lunn
2026-12-01  1:51   ` netdev-bot+sashiko
2026-11-30  0:55 ` [PATCH net 14/14] net: phy: as21xxx: Release reset before reading ID in match Cristian Ciocaltea
2026-11-30  3:53   ` Andrew Lunn
2026-11-30 12:22     ` Cristian Ciocaltea
2026-12-01  1:51   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179608985322.3146.13966944393588293000@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=ansuelsmth@gmail.com \
    --cc=cristian.ciocaltea@collabora.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=hkallweit1@gmail.com \
    --cc=kernel@collabora.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.