[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aEb2WfLHcGBdI3_G@shell.armlinux.org.uk>
Date: Mon, 9 Jun 2025 15:57:29 +0100
From: "Russell King (Oracle)" <linux@...linux.org.uk>
To: Jakub Raczynski <j.raczynski@...sung.com>
Cc: andrew@...n.ch, hkallweit1@...il.com, netdev@...r.kernel.org,
wenjing.shan@...sung.com
Subject: Re: [PATCH] net/mdiobus: Fix potential out-of-bounds read/write
access
On Mon, Jun 09, 2025 at 04:37:58PM +0200, Jakub Raczynski wrote:
> When using publicly available tools like 'mdio-tools' to read/write data
> from/to network interface and its PHY via mdiobus, there is no verification of
> parameters passed to the ioctl and it accepts any mdio address.
> Currently there is support for 32 addresses in kernel via PHY_MAX_ADDR define,
> but it is possible to pass higher value than that via ioctl.
> While read/write operation should generally fail in this case,
> mdiobus provides stats array, where wrong address may allow out-of-bounds
> read/write.
>
> Fix that by adding address verification before read/write operation.
> While this excludes this access from any statistics, it improves security of
> read/write operation.
>
> Fixes: 080bb352fad00 ("net: phy: Maintain MDIO device and bus statistics")
> Signed-off-by: Jakub Raczynski <j.raczynski@...sung.com>
> Reported-by: Wenjing Shan <wenjing.shan@...sung.com>
This is insufficient on its own. If you check the clause 45 accessors,
they have the same issue, so this should also be fixed.
Your patch would've been fine for the blamed commit, but we've had
4e4aafcddbbf ("net: mdio: Add dedicated C45 API to MDIO bus drivers")
in v6.3.
For easier back-porting, it probably makes sense to have this patch
and another separate patch addressing the ones introduced in the
more recent commit - and the two patches sent as a patch series.
Thanks.
--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists