[PATCH v7 10/43] drm/vkms: Reset config->dev when the device creation fails

From: Louis Chauvet

Date: Thu Nov 26 2026 - 06:30:21 EST


vkms_create() stores the vkms_device in config->dev, but the error paths
after that point free the device (through devres_release_group()) without
clearing the pointer. The configuration then keeps a dangling pointer,
which can be dereferenced later (for example by vkms_destroy() or by the
configfs disable path) once the device is already gone.

Clear config->dev in the out_devres error path so the configuration stays
consistent when the device creation fails.

Signed-off-by: Louis Chauvet <louis.chauvet@xxxxxxxxxxx>
---
drivers/gpu/drm/vkms/vkms_drv.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 28b99511f186..4cbb1173fcc6 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -215,6 +215,7 @@ int vkms_create(struct vkms_config *config)

out_devres:
devres_release_group(&fdev->dev, NULL);
+ config->dev = NULL;
out_unregister:
faux_device_destroy(fdev);
return ret;

--
2.56.0