[PATCH] drm: Register the full minor range
From: Andrey Erokhin
Date: Thu Sep 03 2026 - 12:07:36 EST
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")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Andrey Erokhin <language.lawyer@xxxxxxxxx>
---
drivers/gpu/drm/drm_drv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index c808958a2188..25819c88c627 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -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;
--
2.55.0