Message ID | 20231004091253.4194205-2-yoshihiro.shimoda.uh@renesas.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [net,1/2] ravb: Fix dma_free_coherent() of desc_bat timing in ravb_remove() | expand |
On 10/4/23 12:12 PM, Yoshihiro Shimoda wrote: > The dma_free_coherent() in ravb_remove() should be called after How about: In ravb_remove(), dma_free_coherent() should be called after unregister_netdev(). > unregister_netdev(). Otherwise, this controller is possible to use > the freed buffer. > > Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> [...] MBR, Sergey
Concerning the summary: how about the below? ravb: fix up dma_free_coherent() call in ravb_remove()
Hello Sergey, > From: Sergey Shtylyov, Sent: Thursday, October 5, 2023 3:47 AM > Subject: Re: [PATCH net 1/2] ravb: Fix dma_free_coherent() of desc_bat timing in ravb_remove() Thank you for your suggestion in other thread. I'll fix the subject. > On 10/4/23 12:12 PM, Yoshihiro Shimoda wrote: > > > The dma_free_coherent() in ravb_remove() should be called after > > How about: > > In ravb_remove(), dma_free_coherent() should be called after unregister_netdev(). I got it. I'll fix this. > > unregister_netdev(). Otherwise, this controller is possible to use > > the freed buffer. > > > > Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > > Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Thank you for your review! Best regards, Yoshihiro Shimoda > [...] > > MBR, Sergey
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c index 7df9f9f8e134..9e2e801049cc 100644 --- a/drivers/net/ethernet/renesas/ravb_main.c +++ b/drivers/net/ethernet/renesas/ravb_main.c @@ -2891,8 +2891,6 @@ static int ravb_remove(struct platform_device *pdev) clk_disable_unprepare(priv->gptp_clk); 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 */ ravb_write(ndev, CCC_OPC_RESET, CCC); unregister_netdev(ndev); @@ -2900,6 +2898,8 @@ static int ravb_remove(struct platform_device *pdev) netif_napi_del(&priv->napi[RAVB_NC]); netif_napi_del(&priv->napi[RAVB_BE]); 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_disable(&pdev->dev); reset_control_assert(priv->rstc);
The dma_free_coherent() in ravb_remove() should be called after unregister_netdev(). Otherwise, this controller is possible to use the freed buffer. Fixes: c156633f1353 ("Renesas Ethernet AVB driver proper") Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> --- drivers/net/ethernet/renesas/ravb_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)