]> git.karo-electronics.de Git - karo-tx-linux.git/commit
raw: don't allow the creation of a raw device with minor number 0
authorJeff Moyer <jmoyer@redhat.com>
Sun, 20 Jan 2008 19:31:32 +0000 (21:31 +0200)
committerAdrian Bunk <bunk@kernel.org>
Sun, 20 Jan 2008 19:31:32 +0000 (21:31 +0200)
commitac3cb3e487a980ccade6650b85ce845e875af91b
tree582e01638c078f16c6e4446f2b45db5fdf413b3a
parentb3e518873d924913a55b8c90d2968a8cac420054
raw: don't allow the creation of a raw device with minor number 0

Minor number 0 (under the raw major) is reserved for the rawctl device
file, which is used to query, set, and unset raw device bindings.  However,
the ioctl interface does not protect the user from specifying a raw device
with minor number 0:

$ sudo ./raw /dev/raw/raw0 /dev/VolGroup00/swap
/dev/raw/raw0:  bound to major 253, minor 2
$ ls -l /dev/rawctl
ls: /dev/rawctl: No such file or directory
$ ls -l /dev/raw/raw0
crw------- 1 root root 162, 0 Jan 12 10:51 /dev/raw/raw0
$ sudo ./raw -qa
Cannot open master raw device '/dev/rawctl' (No such file or directory)

As you can see, this prevents any further raw operations from
succeeding.  The fix (from Steve Fernandez) is quite simple - do not
allow the allocation of minor number 0.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Signed-off-by: Adrian Bunk <bunk@kernel.org>
drivers/char/raw.c