Skip to content

Commit a2e5255

Browse files
committed
Merge branch 'ravb-fix-use-after-free-issues'
Yoshihiro Shimoda says: ==================== ravb: Fix use-after-free issues This patch series fixes use-after-free issues in ravb_remove(). The original patch is made by Zheng Wang [1]. And, I made the patch 1/2 which I found other issue in the ravb_remove(). [1] https://lore.kernel.org/netdev/20230725030026.1664873-1-zyytlz.wz@163.com/ v1: https://lore.kernel.org/all/20231004091253.4194205-1-yoshihiro.shimoda.uh@renesas.com/ ==================== Link: https://lore.kernel.org/r/20231005011201.14368-1-yoshihiro.shimoda.uh@renesas.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents aba0e90 + 3971442 commit a2e5255

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,6 +2167,8 @@ static int ravb_close(struct net_device *ndev)
21672167
of_phy_deregister_fixed_link(np);
21682168
}
21692169

2170+
cancel_work_sync(&priv->work);
2171+
21702172
if (info->multi_irqs) {
21712173
free_irq(priv->tx_irqs[RAVB_NC], ndev);
21722174
free_irq(priv->rx_irqs[RAVB_NC], ndev);
@@ -2891,15 +2893,15 @@ static int ravb_remove(struct platform_device *pdev)
28912893
clk_disable_unprepare(priv->gptp_clk);
28922894
clk_disable_unprepare(priv->refclk);
28932895

2894-
dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
2895-
priv->desc_bat_dma);
28962896
/* Set reset mode */
28972897
ravb_write(ndev, CCC_OPC_RESET, CCC);
28982898
unregister_netdev(ndev);
28992899
if (info->nc_queues)
29002900
netif_napi_del(&priv->napi[RAVB_NC]);
29012901
netif_napi_del(&priv->napi[RAVB_BE]);
29022902
ravb_mdio_release(priv);
2903+
dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
2904+
priv->desc_bat_dma);
29032905
pm_runtime_put_sync(&pdev->dev);
29042906
pm_runtime_disable(&pdev->dev);
29052907
reset_control_assert(priv->rstc);

0 commit comments

Comments
 (0)