Am 6. April 2025 00:12:45 MESZ schrieb Simon Glass <s...@chromium.org>: >At present, removing the device frees struct dw_eth_dev but does not >disable DMA. When DMA is active, packets can be received even if the >driver is not active. > >While it is possible that the memory used by the struct may remain >untouched after removal, any other allocation may reuse that memory >and result in DMA writing to random addresses. > >In most case U-Boot does this removal in announce_and_cleanup() >immediately before jumping to the OS. No further allocations are done >after that point. > >But with EFI_LOADER this function is not called before jumping to the >EFI app. U-Boot continues to run while GRUB starts and finishes, as well >as while Linux is starting up. During this time, devices cannot be >removed, as they are in use. U-Boot completes the removal when >efi_exit_boot_services() is called. It seems that this function does >more allocations after calling dm_remove_devices_active() although I >can't figure out where. > >Fix this by disabling DMA when the driver is removed. > >Signed-off-by: Simon Glass <s...@chromium.org> >Reported-by: Christian Kohlschütter <christ...@kohlschutter.com>
LGTM Acked-by: Heinrich Schuchardt <xypron.g...@gmx.de> >--- > > drivers/net/designware.c | 1 + > 1 file changed, 1 insertion(+) > >diff --git a/drivers/net/designware.c b/drivers/net/designware.c >index 07b0f49ef58..eebf14bd51a 100644 >--- a/drivers/net/designware.c >+++ b/drivers/net/designware.c >@@ -809,6 +809,7 @@ static int designware_eth_remove(struct udevice *dev) > { > struct dw_eth_dev *priv = dev_get_priv(dev); > >+ _dw_eth_halt(priv); > free(priv->phydev); > mdio_unregister(priv->bus); > mdio_free(priv->bus);