The cleanup order of the driver is quite confusing. At least
two issues exist.
- phylink_destroy() is missing
- The implicit unregister_netdev() at the end of rteth_remove() is called
too late. The manually managed resources are removed before. This can
lead to stale data access.
Convert to register_netdev() and bring rteth_remove() into a meaningful
order to avoid such issues when converting to page_pool.
Link: https://github.com/openwrt/openwrt/pull/23483
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
goto cleanup;
}
- err = devm_register_netdev(&pdev->dev, dev);
+ err = register_netdev(dev);
if (err)
goto cleanup;
struct rteth_ctrl *ctrl = netdev_priv(dev);
pr_info("Removing platform driver for rtl838x-eth\n");
- rteth_hw_stop(ctrl);
+ unregister_netdev(dev);
- netif_tx_stop_all_queues(dev);
+ if (ctrl->phylink)
+ phylink_destroy(ctrl->phylink);
for (int i = 0; i < RTETH_RX_RINGS; i++)
netif_napi_del(&ctrl->rx_qs[i].napi);