]> www.infradead.org Git - nvme.git/commitdiff
drm/qxl: prevent memory leak
authorZongmin Zhou <zhouzongmin@kylinos.cn>
Tue, 1 Aug 2023 02:53:09 +0000 (10:53 +0800)
committerMaxime Ripard <mripard@kernel.org>
Mon, 6 Nov 2023 08:37:03 +0000 (09:37 +0100)
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>
drivers/gpu/drm/qxl/qxl_display.c

index 6492a70e3c396a5b18590a5bf342c18b31560646..404b0483bb7cb91d98703f1cf13a404cb642d1d6 100644 (file)
@@ -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;