]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
drm/vkms: Fix use after free and double free on init error
authorJosé Expósito <jose.exposito89@gmail.com>
Wed, 12 Feb 2025 08:49:12 +0000 (09:49 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 10 Apr 2025 12:31:58 +0000 (14:31 +0200)
commit49a69f67f53518bdd9b7eeebf019a2da6cc0e954
treebf343f2900b85c4c04e6fca82cd4dbc86f52e794
parent9842973b93c4f14cbd3a5a98a9282bf9246a2f1b
drm/vkms: Fix use after free and double free on init error

[ Upstream commit ed15511a773df86205bda66c37193569575ae828 ]

If the driver initialization fails, the vkms_exit() function might
access an uninitialized or freed default_config pointer and it might
double free it.

Fix both possible errors by initializing default_config only when the
driver initialization succeeded.

Reported-by: Louis Chauvet <louis.chauvet@bootlin.com>
Closes: https://lore.kernel.org/all/Z5uDHcCmAwiTsGte@louis-chauvet-laptop/
Fixes: 2df7af93fdad ("drm/vkms: Add vkms_config type")
Signed-off-by: José Expósito <jose.exposito89@gmail.com>
Reviewed-by: Thomas Zimmermann <tzimmremann@suse.de>
Reviewed-by: Louis Chauvet <louis.chauvet@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20250212084912.3196-1-jose.exposito89@gmail.com
Signed-off-by: Louis Chauvet <louis.chauvet@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/vkms/vkms_drv.c