]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: eth: remove false security in rteth_remove()
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Wed, 25 Mar 2026 20:23:35 +0000 (21:23 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Thu, 26 Mar 2026 14:26:26 +0000 (15:26 +0100)
Check for dev in driver remove gives no additional security. The
remove() function is only called if probe() succeeded. Probing
will always call platform_set_drvdata() in the good case. So
remove() will always find dev data via platform_get_drvdata().

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/22610
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
target/linux/realtek/files-6.12/drivers/net/ethernet/rtl838x_eth.c

index bec21648ad82b3225e10f618bd732ef710d1a4ef..f1d3b5492e7d14b1ae97cd28d77bbd99841679bc 100644 (file)
@@ -1616,15 +1616,13 @@ static void rtl838x_eth_remove(struct platform_device *pdev)
        struct net_device *dev = platform_get_drvdata(pdev);
        struct rteth_ctrl *ctrl = netdev_priv(dev);
 
-       if (dev) {
-               pr_info("Removing platform driver for rtl838x-eth\n");
-               rteth_hw_stop(ctrl);
+       pr_info("Removing platform driver for rtl838x-eth\n");
+       rteth_hw_stop(ctrl);
 
-               netif_tx_stop_all_queues(dev);
+       netif_tx_stop_all_queues(dev);
 
-               for (int i = 0; i < RTETH_RX_RINGS; i++)
-                       netif_napi_del(&ctrl->rx_qs[i].napi);
-       }
+       for (int i = 0; i < RTETH_RX_RINGS; i++)
+               netif_napi_del(&ctrl->rx_qs[i].napi);
 }
 
 static const struct of_device_id rteth_of_ids[] = {