This is a note to let you know that I've just added the patch titled drm/client: Fix memory leak in drm_client_modeset_probe to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-client-fix-memory-leak-in-drm_client_modeset_probe.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 2329cc7a101af1a844fbf706c0724c0baea38365 Mon Sep 17 00:00:00 2001 From: Jocelyn Falempe <jfalempe@xxxxxxxxxx> Date: Tue, 11 Jul 2023 11:20:44 +0200 Subject: drm/client: Fix memory leak in drm_client_modeset_probe From: Jocelyn Falempe <jfalempe@xxxxxxxxxx> commit 2329cc7a101af1a844fbf706c0724c0baea38365 upstream. When a new mode is set to modeset->mode, the previous mode should be freed. This fixes the following kmemleak report: drm_mode_duplicate+0x45/0x220 [drm] drm_client_modeset_probe+0x944/0xf50 [drm] __drm_fb_helper_initial_config_and_unlock+0xb4/0x2c0 [drm_kms_helper] drm_fbdev_client_hotplug+0x2bc/0x4d0 [drm_kms_helper] drm_client_register+0x169/0x240 [drm] ast_pci_probe+0x142/0x190 [ast] local_pci_probe+0xdc/0x180 work_for_cpu_fn+0x4e/0xa0 process_one_work+0x8b7/0x1540 worker_thread+0x70a/0xed0 kthread+0x29f/0x340 ret_from_fork+0x1f/0x30 cc: <stable@xxxxxxxxxxxxxxx> Reported-by: Zhang Yi <yizhan@xxxxxxxxxx> Signed-off-by: Jocelyn Falempe <jfalempe@xxxxxxxxxx> Reviewed-by: Javier Martinez Canillas <javierm@xxxxxxxxxx> Reviewed-by: Thomas Zimmermann <tzimmermann@xxxxxxx> Link: https://patchwork.freedesktop.org/patch/msgid/20230711092203.68157-3-jfalempe@xxxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/drm_client_modeset.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -790,6 +790,7 @@ int drm_client_modeset_probe(struct drm_ break; } + kfree(modeset->mode); modeset->mode = drm_mode_duplicate(dev, mode); drm_connector_get(connector); modeset->connectors[modeset->num_connectors++] = connector; Patches currently in stable-queue which might be from jfalempe@xxxxxxxxxx are queue-5.4/drm-client-fix-memory-leak-in-drm_client_modeset_probe.patch queue-5.4/drm-client-fix-memory-leak-in-drm_client_target_cloned.patch