]> www.infradead.org Git - users/jedix/linux-maple.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)
committerLouis Chauvet <louis.chauvet@bootlin.com>
Thu, 13 Feb 2025 14:49:45 +0000 (15:49 +0100)
commited15511a773df86205bda66c37193569575ae828
treecb018d340038a34bc37a444e5a31a6650ac1f881
parentff3881cc6a588f8cd714c9ffbbcc9ef6b02c8d0f
drm/vkms: Fix use after free and double free on init error

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>
drivers/gpu/drm/vkms/vkms_drv.c