[PATCH] register_blkdev(): don't hand out the LOCAL/EXPERIMENTAL majors
authorAndrew Morton <akpm@osdl.org>
Mon, 12 Feb 2007 08:51:44 +0000 (00:51 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
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
blockdev major allocation can hand out majors which LANANA has defined as
being for local/experimental use.

Cc: Torben Mathiasen <device@lanana.org>
Cc: Greg KH <greg@kroah.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Tomas Klas <tomas.klas@mepatek.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
block/genhd.c

index 457fdac4c17d98db97cebd0c6910e23f4f97399f..36bd3e12a6d4c58bdda0dde62237a50d84b93d09 100644 (file)
@@ -61,6 +61,14 @@ int register_blkdev(unsigned int major, const char *name)
        /* temporary */
        if (major == 0) {
                for (index = ARRAY_SIZE(major_names)-1; index > 0; index--) {
+                       /*
+                        * Disallow the LANANA-assigned LOCAL/EXPERIMENTAL
+                        * majors
+                        */
+                       if ((60 <= index && index <= 63) ||
+                                       (120 <= index && index <= 127) ||
+                                       (240 <= index && index <= 254))
+                               continue;
                        if (major_names[index] == NULL)
                                break;
                }