Article View: linux.kernel.netdev
Article #24562Re: [PATCH net 06/14] net: phy: as21xxx: Do not write the IPC reply to a NULL buffer
From: Cristian Ciocaltea
Date: Mon, 30 Nov 2026 10:53
Date: Mon, 30 Nov 2026 10:53
48 lines
10461 bytes
10461 bytes
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 <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.
Indeed, let's move this to the next series.
Thanks,
Cristian
Technical Details
Message-ID:
<585d45e1-4356-41c1-beb9-5678eef1bca8@collabora.com>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-374114-linux-kernel-netdev=dewy.ruReferences:
<20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc@collabora.com> <20261130-as21xxx-fixes-v1-6-1bd2eae6ccbc@collabora.com> <00a82987-ee86-4625-8edb-6bdcbdc42f73@lunn.ch>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-374114-linux-kernel-netdev=dewy.ru From: cristian.ciocaltea@collabora.com (Cristian Ciocaltea) 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 12:53:54 +0200 Organization: Usenet Network Message-ID: <585d45e1-4356-41c1-beb9-5678eef1bca8@collabora.com> References: <20261130-as21xxx-fixes-v1-0-1bd2eae6ccbc@collabora.com> <20261130-as21xxx-fixes-v1-6-1bd2eae6ccbc@collabora.com> <00a82987-ee86-4625-8edb-6bdcbdc42f73@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="1406867"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:AAFKFYjan2rfXpmeTOFq78gDwgE= sha256:neDZeHNIiqWmwUtxtwjDJ3qp6u+S/2ZjVKviKwhsNQ0= sha1:DeaKgUfgqWgnm9RrpcbW/LgbbgQ= sha256:HaBEC0zfsEI+cafe9kkGCYJY6WnG/SNPSs9OtJZ67iU= Content-Language: en-US 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 F3761125FDC; Mon, 30 Nov 2026 13:54:17 +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 (2048-bit key) header.d=collabora.com 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 Oa48knvZjUZ9; Mon, 30 Nov 2026 13:54:15 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-374114-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=collabora.com X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10]) by mail.dewy.ru (Postfix) with ESMTPS id 87122125FD9; Mon, 30 Nov 2026 13:54:06 +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 925A728EAE; Mon, 30 Nov 2026 10:54:03 +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=1796036043; b=3TjrATKiQqWLIf/9fa4JSOzk07tsAshNxkrIHqJqwT/nSU2+LY8pOyfAwPb32nKk7ZlH 1xHM+ROzsI5nrgsUKjpVS0ybaqq8cEq5MjvvSOOANgL89lDYTbBZBHlAqsDeWmWmQa8Sz pdV0ijgwjN8TtiBuo+SLvTzdes8ZUioH6j1v2DA2Ntlc4HN/r5qIk6tIJFyz2h0/zOS2J fSoPZWkz0r4nZxGx5xkUzYm1teGMJeUCzRrGavKeLxxuywrCg/fZ6S8M1EjTMDCdNjgap inFFtEIsRa/YiP9qXBbtkIr8aZPgKgtNt5SM3R+ekf13jyMRlyjmU1cHhh4zADjymfw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796036043; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received: Message-ID:Date:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: User-Agent:Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=mCDYj8k6E9tUgydDA0wQI0O4NwFItWPSJUHctvptEBI=; b=jyNuqXewqAjMWOX28H9sH6zNEJKUMFqCy/DpyhmAo9wO44Nbxm8SvT7aGjsMqL9zNPNY VeoumcI6eGi+4b2H69WZO/6JzBpAqWakWBqjqfF1GL8nJJjpjTopEXKCIDyC+Pny8pXeb iRVV6gI8b3wfhrdQ/V2WrYEqzjjumbhRd+sDR/U2I8OLF1ZeIV+J7WeGq3/GXqUwh884Z PzWZUmDe0b/BcB7rt4VsCtSSIdjKOEqgtmZO/z5OTZdfb+4YjnBmFDx4JU+U6jcuPREQK LfW4wHsUe3XXNzwid2lbL6H7EmY8mGdfA/X4YkBZINcytJiAVQsL5spGRv0EMVqa+ag== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b="WkL/WXLB"; dmarc=pass header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; 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 3C94D606A325; Mon, 30 Nov 2026 10:54:03 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=mail header.b=WkL/WXLB X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=148.251.105.195 X-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== X-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== X-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 X-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 <netdev@vger.kernel.org>; Mon, 30 Nov 2026 10:53:56 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C8032606A32F X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com X-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== X-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) 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-User-Agent: Mozilla Thunderbird 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-In-Reply-To: <00a82987-ee86-4625-8edb-6bdcbdc42f73@lunn.ch>