]> 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:39:14 +0000 (14:39 +0200)
commitd5eb8e347905ab17788a7903fa1d3d06747355f5
tree2c7c6738fb5953962cfc2f2b4c021fc0e2c5e2ba
parentb84d743c2393b33b2b327d9e0c198ff809dee80b
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