From: Andrew Morton Date: Mon, 12 Feb 2007 08:51:44 +0000 (-0800) Subject: [PATCH] register_blkdev(): don't hand out the LOCAL/EXPERIMENTAL majors X-Git-Tag: firefly_0821_release~31122^2~212 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fdf892be32d84a1745fa0aee5fc60517421b8038;p=firefly-linux-kernel-4.4.55.git [PATCH] register_blkdev(): don't hand out the LOCAL/EXPERIMENTAL majors 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 Cc: Greg KH Cc: Al Viro Cc: Tomas Klas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/block/genhd.c b/block/genhd.c index 457fdac4c17d..36bd3e12a6d4 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -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; }