Skip to content

Commit

Permalink
drm/qxl: prevent memory leak
Browse files Browse the repository at this point in the history
[ Upstream commit 0e8b9f2 ]

The allocated memory for qdev->dumb_heads should be released
in qxl_destroy_monitors_object before qxl suspend.
otherwise,qxl_create_monitors_object will be called to
reallocate memory for qdev->dumb_heads after qxl resume,
it will cause memory leak.

Signed-off-by: Zongmin Zhou <zhouzongmin@kylinos.cn>
Link: https://lore.kernel.org/r/20230801025309.4049813-1-zhouzongmin@kylinos.cn
Reviewed-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Zongmin Zhou authored and gregkh committed Nov 28, 2023
1 parent 4e35ae9 commit 1acf029
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/qxl/qxl_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,9 @@ int qxl_destroy_monitors_object(struct qxl_device *qdev)
if (!qdev->monitors_config_bo)
return 0;

kfree(qdev->dumb_heads);
qdev->dumb_heads = NULL;

qdev->monitors_config = NULL;
qdev->ram_header->monitors_config = 0;

Expand Down

0 comments on commit 1acf029

Please sign in to comment.