Commit a2e52554 authored by Jakub Kicinski's avatar Jakub Kicinski

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.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents aba0e909 39714428
...@@ -2167,6 +2167,8 @@ static int ravb_close(struct net_device *ndev) ...@@ -2167,6 +2167,8 @@ static int ravb_close(struct net_device *ndev)
of_phy_deregister_fixed_link(np); of_phy_deregister_fixed_link(np);
} }
cancel_work_sync(&priv->work);
if (info->multi_irqs) { if (info->multi_irqs) {
free_irq(priv->tx_irqs[RAVB_NC], ndev); free_irq(priv->tx_irqs[RAVB_NC], ndev);
free_irq(priv->rx_irqs[RAVB_NC], ndev); free_irq(priv->rx_irqs[RAVB_NC], ndev);
...@@ -2891,8 +2893,6 @@ static int ravb_remove(struct platform_device *pdev) ...@@ -2891,8 +2893,6 @@ static int ravb_remove(struct platform_device *pdev)
clk_disable_unprepare(priv->gptp_clk); clk_disable_unprepare(priv->gptp_clk);
clk_disable_unprepare(priv->refclk); clk_disable_unprepare(priv->refclk);
dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
priv->desc_bat_dma);
/* Set reset mode */ /* Set reset mode */
ravb_write(ndev, CCC_OPC_RESET, CCC); ravb_write(ndev, CCC_OPC_RESET, CCC);
unregister_netdev(ndev); unregister_netdev(ndev);
...@@ -2900,6 +2900,8 @@ static int ravb_remove(struct platform_device *pdev) ...@@ -2900,6 +2900,8 @@ static int ravb_remove(struct platform_device *pdev)
netif_napi_del(&priv->napi[RAVB_NC]); netif_napi_del(&priv->napi[RAVB_NC]);
netif_napi_del(&priv->napi[RAVB_BE]); netif_napi_del(&priv->napi[RAVB_BE]);
ravb_mdio_release(priv); ravb_mdio_release(priv);
dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
priv->desc_bat_dma);
pm_runtime_put_sync(&pdev->dev); pm_runtime_put_sync(&pdev->dev);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
reset_control_assert(priv->rstc); reset_control_assert(priv->rstc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment