drm/renesas: rz-du: Fix MIPI DSI host leak on probe failure
Subsystems (3)
PATCH 1/1 drm/renesas: rz-du: Fix MIPI DSI host leak on probe failure
rzg2l_mipi_dsi_probe() registers the MIPI DSI host before allocating the DCS buffer. If dma_alloc_coherent() fails, probe returns -ENOMEM directly and leaves the host registered.
The remove callback unregisters the host, but remove is only called after a successful probe. Add a local unwind path that unregisters the host before disabling runtime PM on the DCS buffer allocation failure path.
--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +7 -2
@@ -1476,14 +1476,19 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev) dsi->dcs_buf_virt =dma_alloc_coherent (dsi->host.dev,RZG2L_DCS_BUF_SIZE , &dsi->dcs_buf_phys,GFP_KERNEL ); -if (!dsi->dcs_buf_virt) -return -ENOMEM ; +if (!dsi->dcs_buf_virt) { + ret = -ENOMEM ; + goto err_host_unregister; + }return 0 ; err_phy: dsi->info->dphy_exit (dsi);pm_runtime_put (dsi->dev); + goto err_pm_disable; +err_host_unregister: +mipi_dsi_host_unregister (&dsi->host); err_pm_disable:pm_runtime_disable (dsi->dev);return ret;
Biju Das
maintainerHi Myeonghun Pak,
Thanks for the patch.
Quoted 11 lines
-----Original Message-----
From: Myeonghun Pak <[email protected]>
Sent: 24 April 2026 12:59
Subject: [PATCH] drm/renesas: rz-du: Fix MIPI DSI host leak on probe failure
rzg2l_mipi_dsi_probe()registers the MIPI DSI host before allocating the DCS buffer. Ifdma_alloc_coherent()fails, probe returns-ENOMEMdirectly and leaves the host registered.The remove callback unregisters the host, but remove is only called after a successful probe. Add a local unwind path that unregisters the host before disabling runtime PM on the DCS buffer allocation failure path.
A similar patch [1] already posted
Cheers,
Biju
Quoted 34 lines
Signed-off-by Myeonghun Pak <[email protected]>--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/gpu/drm/renesas/rz- renamed from drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +0
-0
du/rzg2l_mipi_dsi.c
index29f2b7d24f..309fae1459100644drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +7
-3@@ -1476,14 +1476,19 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev) dsi->dcs_buf_virt =dma_alloc_coherent (dsi->host.dev,RZG2L_DCS_BUF_SIZE , &dsi->dcs_buf_phys,GFP_KERNEL ); -if (!dsi->dcs_buf_virt) -return -ENOMEM ; +if (!dsi->dcs_buf_virt) { + ret = -ENOMEM ; + goto err_host_unregister; + }return 0 ; err_phy: dsi->info->dphy_exit (dsi);pm_runtime_put (dsi->dev); + goto err_pm_disable; +err_host_unregister: +mipi_dsi_host_unregister (&dsi->host); err_pm_disable:pm_runtime_disable (dsi->dev);return ret; --
Hi Biju,
Thank you for the quick reply.
I've confirmed that a similar patch has already been posted.
Thanks,
Myeonghun Pak
2026년 4월 24일 (금) 오후 9:11, Biju Das <[email protected]>님이 작성:
Quoted 69 lines
Hi Myeonghun Pak,
Thanks for the patch.
Quoted 4 lines
-----Original Message-----
From: Myeonghun Pak <[email protected]>
Sent: 24 April 2026 12:59
Subject: [PATCH] drm/renesas: rz-du: Fix MIPI DSI host leak on probefailure
Quoted 2 lines
rzg2l_mipi_dsi_probe()registers the MIPI DSI host before allocating theDCS buffer. If
Quoted 1 line
dma_alloc_coherent()fails, probe returns-ENOMEMdirectly and leavesthe host registered.
Quoted 2 lines
The remove callback unregisters the host, but remove is only called
after a successful probe. Add a
Quoted 1 line
local unwind path that unregisters the host before disabling runtime PM
on the DCS buffer allocation
Quoted 1 line
failure path.
A similar patch [1] already posted
Cheers,
BijuReview
Quoted 7 lines
Signed-off-by Myeonghun Pak <[email protected]>--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)(quoted diff) +0
-0b/drivers/gpu/drm/renesas/rz-
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c static int rzg2l_mipi_dsi_probe(struct
Quoted 5 lines
du/rzg2l_mipi_dsi.c
index29f2b7d24f..309fae1459100644drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +0
-0@@ -1476,14 +1476,19 @@ static int rzg2l_mipi_dsi_probe(struct
platform_device*pdev)drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c static int rzg2l_mipi_dsi_probe(struct · line 1476
Quoted 2 lines
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +0
-0dsi->dcs_buf_virt = dma_alloc_coherent(dsi->host.dev,
RZG2L_DCS_BUF_SIZE,drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c static int rzg2l_mipi_dsi_probe(struct · line 1477
Quoted 1 line
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +0
-0&dsi->dcs_buf_phys,
GFP_KERNEL);Quoted 19 lines
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +7
-3-if (!dsi->dcs_buf_virt) -return -ENOMEM ; +if (!dsi->dcs_buf_virt) { + ret = -ENOMEM ; + goto err_host_unregister; + }return 0 ; err_phy: dsi->info->dphy_exit (dsi);pm_runtime_put (dsi->dev); + goto err_pm_disable; +err_host_unregister: +mipi_dsi_host_unregister (&dsi->host); err_pm_disable:pm_runtime_disable (dsi->dev);return ret; --