[PATCH] register_chrdev_region() don't hand out the LOCAL/EXPERIMENTAL majors
authorAndrew Morton <[email protected]>
Mon, 12 Feb 2007 08:51:43 +0000 (00:51 -0800)
committerLinus Torvalds <[email protected]>
Mon, 12 Feb 2007 17:48:27 +0000 (09:48 -0800)
As pointed out in http://bugzilla.kernel.org/show_bug.cgi?id=7922, dynamic
chardev major allocation can hand out majors which LANANA has defined as being
for local/experimental use.

Cc: Torben Mathiasen <[email protected]>
Cc: Greg KH <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Tomas Klas <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/char_dev.c

index a885f46ca001f117a9b8bc3bd4ac0e140b5c9e3e..e6194e2b9bb9cbf39c9c85f23d346d55716293a1 100644 (file)
@@ -108,6 +108,13 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor,
        /* temporary */
        if (major == 0) {
                for (i = ARRAY_SIZE(chrdevs)-1; i > 0; i--) {
+                       /*
+                        * Disallow the LANANA-assigned LOCAL/EXPERIMENTAL
+                        * majors
+                        */
+                       if ((60 <= i && i <= 63) || (120 <= i && i <= 127) ||
+                                       (240 <= i && i <= 254))
+                               continue;
                        if (chrdevs[i] == NULL)
                                break;
                }