Re: [PATCH net v1] lan78xx: Fix crash with multiple device attach

From: Andrew Lunn
Date: Tue May 07 2024 - 21:24:11 EST


> The issue was when dual setup of LAN7801 with an external PHY(LAN8841
> in this case) are connected to the same DUT PC, the PC got hanged. The
> issue in seen with external phys only and not observed in case of
> internal PHY being connected(LAN7800). When we looked into the code
> flow we found that in phy_scan_fixup allocates a dev for the first
> device. Before it is unregistered, the second device is attached and
> since we already have a phydev it ignores and does not allocate dev for
> second device. This is the reason why we unregister the first device
> before the second device attach.

This is not making any sense to me.

What this driver is doing odd is registers a fixup per device. So if
you plug in 42 USB dongles, you get the same fixup registered 42
times.

What normally happens is that the fixup is registered once,
globally. So you probably want to move the registration of the fixup
into the module init function, and the unregister into the module exit
function.

Andrew