* [PATCH] drm/msm/dsi: Fix VM leak in dsi_tx_buf_alloc_6g()
@ 2026-09-16 17:57 Wentao Liang
2026-09-26 15:23 ` Rob Clark
2026-10-03 0:46 ` Dmitry Baryshkov
0 siblings, 2 replies; 3+ messages in thread
From: Wentao Liang @ 2026-09-16 17:57 UTC (permalink / raw)
To: abhinav.kumar
Cc: airlied, dri-devel, freedreno, jesszhan0024, linux-arm-msm,
linux-kernel, lumag, marijn.suijten, robin.clark, sean, simona,
Wentao Liang, stable
dsi_tx_buf_alloc_6g() takes a reference to the kms VM with
drm_gpuvm_get() and stores it in msm_host->vm. If
msm_gem_kernel_new() fails, the function returns early without
dropping that reference. Since msm_host->tx_gem_obj is cleared on
the error path, msm_dsi_tx_buf_free() will never see a non-NULL
tx_gem_obj and thus never calls drm_gpuvm_put(), leaking the VM
reference.
Drop the VM reference and clear msm_host->vm on the error path.
Fixes: 5e05be782645 ("drm/msm/dsi: free TX buffer in unbind")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
drivers/gpu/drm/msm/dsi/dsi_host.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 982abaaac00d..29e0de0e0c22 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1250,6 +1250,8 @@ int dsi_tx_buf_alloc_6g(struct msm_dsi_host *msm_host, int size)
if (IS_ERR(data)) {
msm_host->tx_gem_obj = NULL;
+ drm_gpuvm_put(msm_host->vm);
+ msm_host->vm = NULL;
return PTR_ERR(data);
}
--
2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/msm/dsi: Fix VM leak in dsi_tx_buf_alloc_6g()
2026-09-16 17:57 [PATCH] drm/msm/dsi: Fix VM leak in dsi_tx_buf_alloc_6g() Wentao Liang
@ 2026-09-26 15:23 ` Rob Clark
2026-10-03 0:46 ` Dmitry Baryshkov
1 sibling, 0 replies; 3+ messages in thread
From: Rob Clark @ 2026-09-26 15:23 UTC (permalink / raw)
To: Wentao Liang
Cc: abhinav.kumar, airlied, dri-devel, freedreno, jesszhan0024,
linux-arm-msm, linux-kernel, lumag, marijn.suijten, sean, simona,
stable
On Wed, Sep 16, 2026 at 10:58 AM Wentao Liang <vulab@iscas.ac.cn> wrote:
>
> dsi_tx_buf_alloc_6g() takes a reference to the kms VM with
> drm_gpuvm_get() and stores it in msm_host->vm. If
> msm_gem_kernel_new() fails, the function returns early without
> dropping that reference. Since msm_host->tx_gem_obj is cleared on
> the error path, msm_dsi_tx_buf_free() will never see a non-NULL
> tx_gem_obj and thus never calls drm_gpuvm_put(), leaking the VM
> reference.
>
> Drop the VM reference and clear msm_host->vm on the error path.
>
> Fixes: 5e05be782645 ("drm/msm/dsi: free TX buffer in unbind")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Reviewed-by: Rob Clark <rob.clark@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/dsi/dsi_host.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
> index 982abaaac00d..29e0de0e0c22 100644
> --- a/drivers/gpu/drm/msm/dsi/dsi_host.c
> +++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
> @@ -1250,6 +1250,8 @@ int dsi_tx_buf_alloc_6g(struct msm_dsi_host *msm_host, int size)
>
> if (IS_ERR(data)) {
> msm_host->tx_gem_obj = NULL;
> + drm_gpuvm_put(msm_host->vm);
> + msm_host->vm = NULL;
> return PTR_ERR(data);
> }
>
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/msm/dsi: Fix VM leak in dsi_tx_buf_alloc_6g()
2026-09-16 17:57 [PATCH] drm/msm/dsi: Fix VM leak in dsi_tx_buf_alloc_6g() Wentao Liang
2026-09-26 15:23 ` Rob Clark
@ 2026-10-03 0:46 ` Dmitry Baryshkov
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry Baryshkov @ 2026-10-03 0:46 UTC (permalink / raw)
To: abhinav.kumar, Wentao Liang
Cc: airlied, dri-devel, freedreno, jesszhan0024, linux-arm-msm,
linux-kernel, lumag, marijn.suijten, robin.clark, sean, simona,
stable
On Wed, 16 Sep 2026 17:57:38 +0000, Wentao Liang wrote:
> dsi_tx_buf_alloc_6g() takes a reference to the kms VM with
> drm_gpuvm_get() and stores it in msm_host->vm. If
> msm_gem_kernel_new() fails, the function returns early without
> dropping that reference. Since msm_host->tx_gem_obj is cleared on
> the error path, msm_dsi_tx_buf_free() will never see a non-NULL
> tx_gem_obj and thus never calls drm_gpuvm_put(), leaking the VM
> reference.
>
> [...]
Applied to ttt, thanks!
[1/1] drm/msm/dsi: Fix VM leak in dsi_tx_buf_alloc_6g()
https://gitlab.freedesktop.org/lumag/msm/-/commit/ab91ba61871a
Best regards,
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-03 0:47 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16 17:57 [PATCH] drm/msm/dsi: Fix VM leak in dsi_tx_buf_alloc_6g() Wentao Liang
2026-09-26 15:23 ` Rob Clark
2026-10-03 0:46 ` Dmitry Baryshkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®