From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=156.67.10.101 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== 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== 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 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 ; Mon, 30 Nov 2026 02:49:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 1A559606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch 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 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=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1xXrS7-002GMQ-Dx; Mon, 30 Nov 2026 03:49:15 +0100 Date: Mon, 30 Nov 2026 03:49:15 +0100 From: Andrew Lunn To: Cristian Ciocaltea Cc: Christian Marangi , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , 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 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> X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261130-as21xxx-fixes-v1-6-1bd2eae6ccbc@collabora.com> 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 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