From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.251.105.195 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796036037; b=1Vwd+rwD3Wr4lTjfejYgE9ghJOjtgn5gsEsDB9F69lnxJy8py3lvOlv7kJ0PsXZ9IrQ5 r3gFnjKGrkd+rWp1wsCWJEJCRRe5P+tzLMRT5hIa/r7RQaHLaSwJWyOfMUHwwcMI56YSb 4UwNR1M9WImoB0EARnvovRz1EydLOWdSU1GCa/dd9qhn8CVyjJSybMZNizsG8CyIt7TJD JSyzi/Wme6tZYRMdiWnBlveshqplN8GtH0oZveshDQk7a5x7sxgNyWrY27mRN/zAP3+jC Ybz0cw85xI6iiEAZ9bMuC6vJA6/rDsIYBwXLGntpDeUexK7i0+XtZIrVcSFryc/nSwg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796036037; h=DMARC-Filter:DKIM-Signature:Received:Message-ID:Date:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=mCDYj8k6E9tUgydDA0wQI0O4NwFItWPSJUHctvptEBI=; b=p8UY618kVnikbl5+e5PbBSmX0Umnh2QJZ64N3xN3wG8y/JtfahCg/oXFL4/s4LmnGWCl 6SCT4bLN7bnR4ojuGk3yRrRnbWMd3QhARJJsnB2LdWHtRiRmIVg38SOug2tahnXEXPbJN lbzej8Gltda9l6mWLsWIbS5Fn4L9V8acFApSuklMLvtOakpMtCJ9JBFzhQPcJ+2rHae18 hG747CgF3ZyTfH1TY0Ht7Mot4OIC0ml+ASMonwVqdMsd6TZSRjTgTY84MgeuIerezn8Z+ NUSWRzXN1eeJP6/Fi333gwZh+zayE9m7ZL2eC5b5tnCNG/cqlEzATk1YD6ZcKie2Dww== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b="WkL/WXLB"; arc=none smtp.remote-ip=148.251.105.195 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (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 C8032606A32F for ; Mon, 30 Nov 2026 10:53:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C8032606A32F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=WkL/WXLB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1796036035; bh=bybm2GnbWkwBJ6/ogo1g1d0H2gnVWVcIiKJSGtb8AFU=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=WkL/WXLBx9NU4jpQRNuO7b4Q8mxdVxFC7ByTsGNLTBg7xyPCJQ/GqIT5u1BcSUv79 QD1MNzptGB4fscCttL3aTmh9d7LVtfYEngzZiskA36RN96BJvKdCvYznPZXH71v2sp EEbj1BXQYy6l7MG+7757WO/Bl7lbAMNYk2hTp7m5J4O5VlUI3KX63iZxO8zCZMwTrj hzcw+3jyMoLt0XBUxYyj1srhnn/e/xJgkxXdtT8+IE75CwfEh5ESYRZRaFXcM7iFZS W6MGuHMCbmnLhEDuqT2jHDnVLHm6IouBKJsFhbyWIzrtjwNbKERzxXgVv4U0nh2bGH r9+poCUmNkJkQ== Received: from [100.64.0.241] (unknown [100.64.0.241]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519) (No client certificate requested) (Authenticated sender: cristicc) by bali.collaboradmins.com (Postfix) with ESMTPSA id 9CB7917E01C2; Mon, 30 Nov 2026 11:53:54 +0100 (CET) Message-ID: <585d45e1-4356-41c1-beb9-5678eef1bca8@collabora.com> Date: Mon, 30 Nov 2026 12:53:54 +0200 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 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net 06/14] net: phy: as21xxx: Do not write the IPC reply to a NULL buffer To: Andrew Lunn Cc: Christian Marangi , Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , kernel@collabora.com, netdev@vger.kernel.org References: <20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc@collabora.com> <20261130-as21xxx-fixes-v1-6-1bd2eae6ccbc@collabora.com> <00a82987-ee86-4625-8edb-6bdcbdc42f73@lunn.ch> Content-Language: en-US From: Cristian Ciocaltea In-Reply-To: <00a82987-ee86-4625-8edb-6bdcbdc42f73@lunn.ch> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 11/30/26 4:49 AM, Andrew Lunn wrote: > 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? Sure, I somehow missed to correct it. >> 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. Ok, I'll drop the 'data_len && !data' check and just keep the '!ret_data' one. >> 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. Indeed, let's move this to the next series. Thanks, Cristian