Skip to content

Commit e6864af

Browse files
shimodaykuba-moo
authored andcommitted
ravb: Fix up dma_free_coherent() call in ravb_remove()
In ravb_remove(), dma_free_coherent() should be call after unregister_netdev(). Otherwise, this controller is possible to use the freed buffer. Fixes: c156633 ("Renesas Ethernet AVB driver proper") Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Link: https://lore.kernel.org/r/20231005011201.14368-2-yoshihiro.shimoda.uh@renesas.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
1 parent aba0e90 commit e6864af

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

drivers/net/ethernet/renesas/ravb_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2891,15 +2891,15 @@ static int ravb_remove(struct platform_device *pdev)
28912891
clk_disable_unprepare(priv->gptp_clk);
28922892
clk_disable_unprepare(priv->refclk);
28932893

2894-
dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
2895-
priv->desc_bat_dma);
28962894
/* Set reset mode */
28972895
ravb_write(ndev, CCC_OPC_RESET, CCC);
28982896
unregister_netdev(ndev);
28992897
if (info->nc_queues)
29002898
netif_napi_del(&priv->napi[RAVB_NC]);
29012899
netif_napi_del(&priv->napi[RAVB_BE]);
29022900
ravb_mdio_release(priv);
2901+
dma_free_coherent(ndev->dev.parent, priv->desc_bat_size, priv->desc_bat,
2902+
priv->desc_bat_dma);
29032903
pm_runtime_put_sync(&pdev->dev);
29042904
pm_runtime_disable(&pdev->dev);
29052905
reset_control_assert(priv->rstc);

0 commit comments

Comments
 (0)