* [PATCH] drm/amd/display: Fix memory leak in dm_set_writeback()
@ 2023-12-08 9:58 Harshit Mogalapalli
2023-12-11 20:12 ` Alex Hung
0 siblings, 1 reply; 2+ messages in thread
From: Harshit Mogalapalli @ 2023-12-08 9:58 UTC (permalink / raw)
To: Harry Wentland, Leo Li, Alex Deucher, Christian König,
David (ChunMing) Zhou, David Airlie, Daniel Vetter, Sherry Yang,
Greg Kroah-Hartman, Sasha Levin, Roman Li, Claudio Suarez,
hongao, Aurabindo Pillai, amd-gfx, dri-devel, linux-kernel
Cc: dan.carpenter, kernel-janitors, error27, harshit.m.mogalapalli
'wb_info' needs to be freed on error paths or it would leak the memory.
Smatch pointed this out.
Fixes: c81e13b929df ("drm/amd/display: Hande writeback request from userspace")
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
---
This is based on static analysis and only compile tested
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
index afdcc43ea06c..333995f70239 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -8871,12 +8871,14 @@ static void dm_set_writeback(struct amdgpu_display_manager *dm,
acrtc = to_amdgpu_crtc(wb_conn->encoder.crtc);
if (!acrtc) {
DRM_ERROR("no amdgpu_crtc found\n");
+ kfree(wb_info);
return;
}
afb = to_amdgpu_framebuffer(new_con_state->writeback_job->fb);
if (!afb) {
DRM_ERROR("No amdgpu_framebuffer found\n");
+ kfree(wb_info);
return;
}
--
2.39.3
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] drm/amd/display: Fix memory leak in dm_set_writeback()
2023-12-08 9:58 [PATCH] drm/amd/display: Fix memory leak in dm_set_writeback() Harshit Mogalapalli
@ 2023-12-11 20:12 ` Alex Hung
0 siblings, 0 replies; 2+ messages in thread
From: Alex Hung @ 2023-12-11 20:12 UTC (permalink / raw)
To: Harshit Mogalapalli, Harry Wentland, Leo Li, Alex Deucher,
Christian König, David (ChunMing) Zhou, David Airlie,
Daniel Vetter, Sherry Yang, Greg Kroah-Hartman, Sasha Levin,
Roman Li, Claudio Suarez, hongao, Aurabindo Pillai, amd-gfx,
dri-devel, linux-kernel
Cc: kernel-janitors, error27, dan.carpenter
Thanks for catching this.
Reviewed-by: Alex Hung <alex.hung@amd.com>
On 2023-12-08 02:58, Harshit Mogalapalli wrote:
> 'wb_info' needs to be freed on error paths or it would leak the memory.
>
> Smatch pointed this out.
>
> Fixes: c81e13b929df ("drm/amd/display: Hande writeback request from userspace")
> Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
> ---
> This is based on static analysis and only compile tested
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index afdcc43ea06c..333995f70239 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -8871,12 +8871,14 @@ static void dm_set_writeback(struct amdgpu_display_manager *dm,
> acrtc = to_amdgpu_crtc(wb_conn->encoder.crtc);
> if (!acrtc) {
> DRM_ERROR("no amdgpu_crtc found\n");
> + kfree(wb_info);
> return;
> }
>
> afb = to_amdgpu_framebuffer(new_con_state->writeback_job->fb);
> if (!afb) {
> DRM_ERROR("No amdgpu_framebuffer found\n");
> + kfree(wb_info);
> return;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-12-11 20:12 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-08 9:58 [PATCH] drm/amd/display: Fix memory leak in dm_set_writeback() Harshit Mogalapalli
2023-12-11 20:12 ` Alex Hung
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®