Bug 7922

Summary: dynamic device major number allocation conflicts with local/experimental range
Product: File System Reporter: Tomas Klas (tomas.klas)
Component: OtherAssignee: fs_other
Status: RESOLVED CODE_FIX    
Severity: normal CC: randy.dunlap
Priority: P2    
Hardware: i386   
OS: Linux   
Kernel Version: 2.6.20 Subsystem:
Regression: --- Bisected commit-id:

Description Tomas Klas 2007-02-02 04:38:30 UTC
__register_chrdev_region in fs/char_dev.c uses major device numbers numbers from
254 down for dynamic allocation, but this range is reserved for
"local/experimental use" in LANANA Device List.

quote from "http://www.lanana.org/docs/device-list/devices-2.6+.txt":
--------
240-254 char	LOCAL/EXPERIMENTAL USE
240-254 block	LOCAL/EXPERIMENTAL USE
		Allocated for local/experimental use.  For devices not
		assigned official numbers, these ranges should be
		used in order to avoid conflicting with future assignments.
--------

I wrote my "local/experimental" driver with major 253, to "avoid conflicting
with future assignments", all works fine. Then I select some new fetures etc.
and vuala, major 253 is now allocated by usb_endpoint.

Please exclude local/experimental range from dynamic allocation, or add some
notice to device list.
Comment 1 Tomas Klas 2007-02-02 04:59:41 UTC
I think better range for dynamic allocation are unused numbers 231-239.

--- char_dev.c  2007-02-02 14:03:24.000000000 +0100
+++ char_dev1.c 2007-02-02 14:03:14.000000000 +0100
@@ -109,3 +109,3 @@
        if (major == 0) {
-               for (i = ARRAY_SIZE(chrdevs)-1; i > 0; i--) {
+               for (i = 231; i <= 239; i++) {
                        if (chrdevs[i] == NULL)
Comment 2 Andrew Morton 2007-02-02 14:26:51 UTC
I queued a patch, thanks.