Skip to contentSkip to conversation

drm: Register the full minor range

PATCH New Andrey Erokhin 1 participant 1 message Sep 3

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Register the full minor range

Commit 071d583e01c8 ("drm: Expand max DRM device number to full MINORBITS") expanded DRM minor allocation to the full range provided by MINORBITS. However, drm_core_init() still uses register_chrdev(),
which registers only minors 0 through 255.

Consequently, character-device lookup for a DRM minor greater than 255 fails with -ENXIO before drm_stub_open() can handle the open.

Register and unregister the full minor range explicitly.

Fixes 071d583e01c8 ("drm: Expand max DRM device number to full MINORBITS")
---
 drivers/gpu/drm/drm_drv.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/drm_drv.c +2 -2
index c808958a2188..25819c88c627 100644
@@ -1250,7 +1250,7 @@ static void drm_core_exit(void)
 	drm_privacy_screen_lookup_exit();
 	drm_panic_exit();
 	accel_core_exit();
-	unregister_chrdev(DRM_MAJOR, "drm");
+	__unregister_chrdev(DRM_MAJOR, 0, MINORMASK + 1, "drm");
 	drm_debugfs_remove_root();
 	drm_sysfs_destroy();
 	WARN_ON(!xa_empty(&drm_minors_xa));
@@ -1273,7 +1273,7 @@ static int __init drm_core_init(void)
 	drm_debugfs_init_root();
 	drm_debugfs_bridge_params();
 
-	ret = register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops);
+	ret = __register_chrdev(DRM_MAJOR, 0, MINORMASK + 1, "drm", &drm_stub_fops);
 	if (ret < 0)
 		goto error;
 
Signature · 1 line
2.55.0