From: Andrew Morton Date: Mon, 12 Feb 2007 08:51:43 +0000 (-0800) Subject: [PATCH] register_chrdev_region() don't hand out the LOCAL/EXPERIMENTAL majors X-Git-Tag: v2.6.21-rc1~274^2~206 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=215122e1110f97a3f478829049b9840cf8fdde57;p=linux-2.6 [PATCH] register_chrdev_region() don't hand out the LOCAL/EXPERIMENTAL majors 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 Cc: Greg KH Cc: Al Viro Cc: Tomas Klas Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/char_dev.c b/fs/char_dev.c index a885f46ca0..e6194e2b9b 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c @@ -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; }