Article View: linux.kernel.netdev
Article #24325Re: [PATCH net 06/14] net: phy: as21xxx: Do not write the IPC reply to a NULL buffer
From: Andrew Lunn
Date: Mon, 30 Nov 2026 02:49
Date: Mon, 30 Nov 2026 02:49
41 lines
9787 bytes
9787 bytes
On Mon, Nov 30, 2026 at 02:55:13AM +0200, Cristian Ciocaltea wrote:
> 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).
The comment at the beginning of the function is also wrong:
/* If data is NULL, return 0 or negative error.
* If data not NULL, return number of Bytes received from IPC or
* a negative error.
*/
static int aeon_ipc_send_msg(struct phy_device *phydev,
u16 opcode, u16 *data, unsigned int data_len,
u16 *ret_data)
{
Maybe a later patch fixes that?
> A caller supplying
> a payload but a NULL ret_data would have the reply written through a
> NULL pointer.
>
> Check ret_data before copying the reply. While at it, validate the
> input buffer at function entry, rejecting a NULL data pointer with a
> non-zero data_len.
I would actually let this explode. The oops makes it clear where the
bug is, returning EINVAL will be harder to correct, there is already
three of them in this function.
> Fixes: 830877d89edc ("net: phy: Add support for Aeonsemi AS21xxx PHYs")
> Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
This is purely about validation of the passed parameters, that the
validation is not strictly correct. As far as i see, nothing in the
happy days case is actually broken? So this should go via net-next.
Andrew
Technical Details
Message-ID:
<00a82987-ee86-4625-8edb-6bdcbdc42f73@lunn.ch>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-373786-linux-kernel-netdev=dewy.ruReferences:
<20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc@collabora.com> <20261130-as21xxx-fixes-v1-6-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-373786-linux-kernel-netdev=dewy.ru From: andrew@lunn.ch (Andrew Lunn) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net 06/14] net: phy: as21xxx: Do not write the IPC reply to a NULL buffer Date: Mon, 30 Nov 2026 03:49:15 +0100 Organization: Usenet Network Message-ID: <00a82987-ee86-4625-8edb-6bdcbdc42f73@lunn.ch> References: <20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc@collabora.com> <20261130-as21xxx-fixes-v1-6-1bd2eae6ccbc@collabora.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="1314744"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:wV1262ZyOwYWtZynM/OAf7cafnk= sha256:D7Ci3sfXmnZ+3DAQKWSidU+Nhx394etw0wWKoboGJpU= sha1:M3qfajDQuD3WETgvmWC2J8IKcjI= sha256:SojrT2XHr6ettmFv4MMEROI9D+Y9+Pt1MkEYjs9fKfE= Content-Disposition: inline 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 2EB59125FB8; Mon, 30 Nov 2026 05:49:52 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.051 X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (1024-bit key) header.d=lunn.ch 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 Lo4rkMuwS5pB; Mon, 30 Nov 2026 05:49:44 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-373786-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=lunn.ch X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id E3E6A125F08; Mon, 30 Nov 2026 05:49:33 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sea.lore.kernel.org (Postfix) with ESMTP id 6873B271AC; Mon, 30 Nov 2026 02:49:31 +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=1796006971; b=hw1DQ62EbgNbM/w67TBjvd56aHahNJh5IauuF7cOkQGxLLUlFTDsF/r4fbetu5HSZ+YH j/Fjahzhzbbvlw6Yf64aaMsmfeXxBZA9riej3lIfEwSEtIxICWXByzoPfKp3S6QPHWVnh Bdc2i70odrgSslhwBsdkMpVI4aeaAaxm412IY3fDt/NpO6w1vg7bjU7zkpTnTjTMi8tre cI3Oq49OZUjV9D5oqXZ10416mRjKU42uFumY1pSqWRiSlUD0hVcVQowF8YtVwCBd9+Qj1 tLyx8E7gP1buR7o353q51qkN13CpZNj/yQkw35T7GGk0CR4AVhzycEbuSHH0oqTg2ag== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796006971; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:Date: From:To:Cc:Subject:Message-ID:References:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=iNBM476qW8FCubl6A5zr6tvx0F0euCfWPaOaeysMEf8=; b=JA0CYFzbXaY+USCbRlnr/UfYkRfn/tnWrfuJrR4DDqAY8ky9gISS/BMFS6wkPM5aYtCc rmHuToiEMX982wdhieEzAeZ+TH3cnkPYCv/Jp3OVuJ4Oqi8BUVhURVJGSmTR9YyuQnfqO xgnuTXHhvZBfbtX6ov2A7E3DWHpuWnW+ZOylvnE5gxkC1RA3ZaQr0pVQRo69ghvZblwvT vKwgcynEFfE6bjuptWW027PRY8IpLZOPkn3E+GXvN1wXU/kug7+QP1Eyx9FiYHdlDKpIA spzN6k2F/qEjsqlWUoQOAgarOZE7FJ7ijNshe4rODYwYZDhtYmvN495R40QcisMlDpA== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=pU87JUrS; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; 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 4022C606A327; Mon, 30 Nov 2026 02:49:31 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=pU87JUrS X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796006970; b=f7IpB5fxVsl9v1ehWDB+zHUp4aiuSNpQiz1QNnTnbKaDB+g6mDwqt1Yaw8Yh3hWGHp3H xnnhKgeryNLl11w3qi0dnB1v2dc8K/ll6bADrnsGcZDVhQwuzTQAB7Gn3/91CqygJu7pR dSu6toPlJ1r0wW9l/PBWcaOR/vEyHIu/ZSXkU7hxPlF2GyiVWVeXJ2K6xhfVzCwLZPzX0 zg+1Yd8xFfxPB5kezlPzWJu7/jaakMq38DuAUthVlJxwx9KsIaFwJ9YPEWb4FEHvY3gcg RPf+uJYcOYHcp2NPX5h4b7FrTsyvjGkFisFMUanvz5kZ3Ngp6+t35X9c2JFGTykor5A== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796006970; h=DMARC-Filter:DKIM-Signature:Received:Date:From:To:Cc:Subject: Message-ID:References:MIME-Version:Content-Type:Content-Disposition: In-Reply-To; bh=iNBM476qW8FCubl6A5zr6tvx0F0euCfWPaOaeysMEf8=; b=j/x6NZcJ+JZVpBkS6DXNHDta8N6V0nfJIOWL5Uit9hzaX+qFod/KffsexA+RpSmE2RPE /S1nwvAB3/loNHbud4QQkM3VGY+DksIeg7ocix4oQRx+NF3XnK/MooxVq4AhOuXiPnlXL sgWLQvh7QkKtVnHOXObQ1jU8K/skHZtjOjpzxTKn4XvI1efF6MNGuYrUPk5+mvEwC1t7a wZVDMiIVOA3WKkyKEuyIBQ2cjfaS+AU9CbYXGj39I0Bv2+2hPRMv/FwkfvmEbh7c3nnaF 86LTMrSX+hyJq4p6EC/LN5kzjizyaKyu01bWnbDRP9+xZ6KWJUm1y2ppuweZo6j/CyQ== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass header.d=lunn.ch header.i=@lunn.ch header.a=rsa-sha256 header.s=20171124 header.b=pU87JUrS; arc=none smtp.remote-ip=156.67.10.101 X-Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (prime256v1) server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A559606A31C for <netdev@vger.kernel.org>; Mon, 30 Nov 2026 02:49:29 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1A559606A31C X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch X-DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=iNBM476qW8FCubl6A5zr6tvx0F0euCfWPaOaeysMEf8=; b=pU87JUrS9SWZfPfcjwJD8b9dPb TZEkmwQ0bZG3kJkDCKjWRpFTX8Wtfhz4P3TrA1vpbCI5Q7WyZtlc61BvmvXd3nSw2tZ/MnFGCwVAr sAE9qe1UlfFC84eP7iB3TK359m9/jvBKYFayaoFcq1eJQI3evlD4fuWWnDnaR9DrQ8Lo=; X-Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from <andrew@lunn.ch>) id 1xXrS7-002GMQ-Dx; Mon, 30 Nov 2026 03:49:15 +0100 X-Cc: Christian Marangi <ansuelsmth@gmail.com>, Heiner Kallweit <hkallweit1@gmail.com>, Russell King <linux@armlinux.org.uk>, "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, kernel@collabora.com, netdev@vger.kernel.org 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 X-In-Reply-To: <20261130-as21xxx-fixes-v1-6-1bd2eae6ccbc@collabora.com>