[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231115033608.1229058-2-sashal@kernel.org>
Date: Tue, 14 Nov 2023 22:35:56 -0500
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org, stable@...r.kernel.org
Cc: Zongmin Zhou <zhouzongmin@...inos.cn>,
Dave Airlie <airlied@...hat.com>,
Maxime Ripard <mripard@...nel.org>,
Sasha Levin <sashal@...nel.org>, kraxel@...hat.com,
maarten.lankhorst@...ux.intel.com, tzimmermann@...e.de,
airlied@...il.com, daniel@...ll.ch, virtualization@...ts.linux.dev,
spice-devel@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org
Subject: [PATCH AUTOSEL 6.1 2/6] drm/qxl: prevent memory leak
From: Zongmin Zhou <zhouzongmin@...inos.cn>
[ 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@...inos.cn>
Link: https://lore.kernel.org/r/20230801025309.4049813-1-zhouzongmin@kylinos.cn
Reviewed-by: Dave Airlie <airlied@...hat.com>
Signed-off-by: Maxime Ripard <mripard@...nel.org>
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
drivers/gpu/drm/qxl/qxl_display.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/qxl/qxl_display.c b/drivers/gpu/drm/qxl/qxl_display.c
index a152a7c6db215..f91a86225d5e7 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;
--
2.42.0
Powered by blists - more mailing lists