Commit:     38584c14bbba02d8aedace335073b30e49de66a0
Parent:     11f57cedcf382574a1e41d6cec2349f287fcea67
Author:     Jeff Moyer <[EMAIL PROTECTED]>
AuthorDate: Sat Feb 10 01:46:10 2007 -0800
Committer:  Linus Torvalds <[EMAIL PROTECTED]>
CommitDate: Sun Feb 11 10:51:34 2007 -0800

    [PATCH] 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 <[EMAIL PROTECTED]>
    Cc: Steven Fernandez <[EMAIL PROTECTED]>
    Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
    Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>
 drivers/char/raw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/raw.c b/drivers/char/raw.c
index 645e20a..1f0d7c6 100644
--- a/drivers/char/raw.c
+++ b/drivers/char/raw.c
@@ -154,7 +154,7 @@ static int raw_ctl_ioctl(struct inode *inode, struct file 
                        goto out;
-               if (rq.raw_minor < 0 || rq.raw_minor >= MAX_RAW_MINORS) {
+               if (rq.raw_minor <= 0 || rq.raw_minor >= MAX_RAW_MINORS) {
                        err = -EINVAL;
                        goto out;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to