VKMS ConfigFS devices can be disabled while userspace still holds open file descriptors. Using drm_dev_unregister() leaves the device in a state where ioctls are still accepted but internal locks can contend with the teardown path. Specifically, drmModeGetConnector() triggers fill_modes which acquires mode_config locks that contend with drm_atomic_helper_shutdown().
Use drm_dev_unplug() instead, which marks the device as unplugged so the ioctl layer rejects subsequent calls with -ENODEV. The previous commit added drm_dev_enter()/drm_dev_exit() guards to vkms callbacks, so synchronize_srcu() in drm_dev_unplug() properly waits for any in-flight operations before the teardown proceeds. Signed-off-by: Sebastian Wick <[email protected]> --- drivers/gpu/drm/vkms/vkms_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c index 5a640b531d88..716f9c966c21 100644 --- a/drivers/gpu/drm/vkms/vkms_drv.c +++ b/drivers/gpu/drm/vkms/vkms_drv.c @@ -259,7 +259,7 @@ void vkms_destroy(struct vkms_config *config) fdev = config->dev->faux_dev; - drm_dev_unregister(&config->dev->drm); + drm_dev_unplug(&config->dev->drm); drm_atomic_helper_shutdown(&config->dev->drm); devres_release_group(&fdev->dev, NULL); faux_device_destroy(fdev); -- 2.56.0
