🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #24894

Re: [PATCH net 06/14] net: phy: as21xxx: Do not write the IPC reply to a NULL buffer

#24894
From: netdev-bot+sashiko
Date: Tue, 01 Dec 2026 01:50
105 lines
11468 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 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
Technical Details
Message-ID: <179608985322.3146.13966944393588293000@kernel.org>
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374615-linux-kernel-netdev=dewy.ru
References: <20261130-as21xxx-fixes-v1-6-1bd2eae6ccbc@collabora.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-374615-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179608985322.3146.13966944393588293000@kernel.org>
References: <20261130-as21xxx-fixes-v1-6-1bd2eae6ccbc@collabora.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1586815"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gvP/Gm6bH9IdA2ZckszySd9hzSE= sha256:891/1037vDJRMrBAz7etpzIwYjPfrjt7iLS6URebJnE=
	sha1:K4e2Arlsj2MRxrD3J9flg6exzQs= sha256:My+ShEz6YCld6N++Iritjzl8Lq1ko5g8r6Gi9vMBCPw=
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 C4A501171F5; Tue,  1 Dec 2026 04:51:14 +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 4owZaXHK7eby;
	Tue,  1 Dec 2026 04:51:10 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-374615-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 6003A1171BE; Tue,  1 Dec 2026 04:51:00 +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 BF4C4260EA; Tue,  1 Dec 2026 01:50:57 +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=1796089855;
	b=Djwdei3Djj2OAX8+LQT7dTJHfq7zPorROSRmHCX2zLCALBWw7hwJjncsnIdaPQdvaI3u
	 S/bjZxk9Zviyj5qt6URTMjH/qArETTCgy/MTTdgXjVYHhjQQ/btP/EYA7OBuDXiZ0OGSl
	 VU+aTLVrCVWIzQAo+N3JgU+Sclli6vm7IChrDddHTyohNykIHOCM4m7NzZz1zib66ehBn
	 ZNNULb9CWoQtvMtmbdy3+STuVnMTkAMy42EY3dMo6Oovsve2V9tgqDlCbhdSmFTqgSv6R
	 g9pnOHz796Km9L3PDqO+ZJpXJZjriD5ve568qimCATuIp59a8j1u6JoNlEMMym+jHxw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796089855;
	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=9xiAWg8Ev4hJ4c50ajcZCvRvE0rbzi4RFAbC8IvWW9g=;
	b=mE9ul6JpWmnweBu4wjbuLodlnRSAT56DJkIMgCXu3YpkiJoNYkdTDyLMrNBLdv7zo+Bd
	 se1zYW6fgs+C1YLXTlkst/d8vwrDaWdK8A8e4V4TQ0JMs1fLuq1fSFCTIyMG6glp9G+KA
	 P5OesOW2P1sNAFX/dM35CIxfHKmpmPNxr1OtVrW6kGuyrjnH0o9vV7GoM6cI5aqi8dfIt
	 TFcVh5KSWgpPaiQOk/LN+U5DqdNzuEbvEwIMIsjPVWu9mI4BVrfJdH1hPnVev+d1hVQkO
	 1zIctRWTJP1mUyRTHARxQz+7HSqdt6kyb1XCt/5PvWKknvpkm5JFfrsfcyRW8ERNhaw==
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=Pioo026M;
	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 897A2606A337;
	Tue,  1 Dec 2026 01:50:55 +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=Pioo026M
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=1796089854;
	b=w00cgwlzAmwIjQRpFj0QnSI1A5sZkYxmZp4E1kieQCm+mNaPB0jZ2ML4e1EBf5/kUDBe
	 Byvr6miyrsUQovnVH5PAqMrpAyzqAQYLEtrl26aWgYcJRTtdU5IpROW1OiKT6FsO+J+c6
	 qvviF0C5Z0p7Z+mBoO3IehJf2RdAf1RAYZ300pk5p4mpP2kFOV2aXTjNU/LmpkpHfXqtk
	 VYoRgg1NLUgZDR9sbynm168+g4PQb6MSO5/83rqL0ge9Buh2Ws+JiTlqXchtwoBRfniOL
	 CF4h/B3+cX5rQPixVwhQOwVpM0Epo97tq1KTc28EBmJ3Jwrc4JRqjVchB6uT33m4JAQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796089854;
	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=9xiAWg8Ev4hJ4c50ajcZCvRvE0rbzi4RFAbC8IvWW9g=;
	b=f84bB0sDzzkN9/O2cAfItoMFlds2mYFb7fJiRBJiYEH27jhT1rjwqSAl20X08LJZvc9e
	 msRuUE8SQ6aK+K87fQO6md495s4MUAKymJejVS/1XEn1zLW36uhNYriaHx9Rgbu4BVRIo
	 OVRvtGxtdU935yYofqwMBjsNXjDk/blcMgKHHS8EqriNNb1gmQoQg5eGVwR6nW9cCe+kD
	 FcfKzvhew/P9B4OYVAr/CYch2Ks7nlhJRjqW5bq33hBQDveeP7u2l6LEN28/eAR/Gn90n
	 KKQkhl/6IP8Nli8I0JZNuNdsHbjF7tGsnHd7BIvU/5BG7tEXL3F2a18MughAAhOyZYw==
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=Pioo026M;
	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 A8B74606A32F
	for <netdev@vger.kernel.org>; Tue,  1 Dec 2026 01:50:54 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id ADE371F000C1;
	Tue,  1 Dec 2026 01:50:53 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796089854;
	bh=9xiAWg8Ev4hJ4c50ajcZCvRvE0rbzi4RFAbC8IvWW9g=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Pioo026MP9eOBkxLfo0dC944247Xo7Q3TGjOsvZZ2t98ySllit0mZ3Gwh13lDwwBK
	 lYgm5RSN459V3Mnxtw6DBqaYYHJW2WZ/CBWHlMw20lq2Neabw7JRRbNMQhPEkDSHwg
	 ogF4ogCVgtJX0iKxTg/j8SILfR+iL8iLqp0Nl5p9cz1St8pJgih35gQ/ZmkUYJlUWb
	 DctFXbO4L1WrulI203gNF8yZsSpQbOSxlqD+aK8/yyi/AfO8kEDvG/UH3wfOmEusOm
	 WXfM/RaO7pqDr+s7IkGcLLgeNz8jULn+3aNF43DD0Oh0iWabKApBfqD01bhosEvXAz
	 T0wzOkfmxD5Rw==
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-6-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