summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZongmin Zhou <zhouzongmin@kylinos.cn>2023-08-01 10:53:09 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-11-28 17:14:52 +0000
commit1acf0293d713452c5b58d099df961de2866a9492 (patch)
treec4c4fce97b35c528accd59f5eb5dafcea4c114ec
parent4e35ae99f85d90d9dbfb554bd0425badd75d8e38 (diff)
downloadlinux-stable-1acf0293d713452c5b58d099df961de2866a9492.tar.gz
linux-stable-1acf0293d713452c5b58d099df961de2866a9492.tar.bz2
linux-stable-1acf0293d713452c5b58d099df961de2866a9492.zip
drm/qxl: prevent memory leak
[ Upstream commit 0e8b9f258baed25f1c5672613699247c76b007b5 ] 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>
-rw-r--r--drivers/gpu/drm/qxl/qxl_display.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index 6492a70e3c39..404b0483bb7c 100644
--- a/drivers/gpu/drm/qxl/qxl_display.c
+++ b/drivers/gpu/drm/qxl/qxl_display.c
@@ -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;