[PATCH] scsi_ioctl: only warn for rejected commands
authorJens Axboe <axboe@suse.de>
Fri, 7 Oct 2005 17:41:34 +0000 (19:41 +0200)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 8 Oct 2005 22:00:57 +0000 (15:00 -0700)
We should not be warning about commands that we allow, even if they are
unknown. So move the if-root-allow check up a notch.

Signed-off-by: Jens Axboe <axboe@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/block/scsi_ioctl.c

index 079ec344eb4768677248b39a7a474c0b2c00a8d1..382dea7b224c61b87c354fdb425ad7b6f3e19c39 100644 (file)
@@ -201,15 +201,15 @@ static int verify_command(struct file *file, unsigned char *cmd)
                        return 0;
        }
 
+       /* And root can do any command.. */
+       if (capable(CAP_SYS_RAWIO))
+               return 0;
+
        if (!type) {
                cmd_type[cmd[0]] = CMD_WARNED;
                printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]);
        }
 
-       /* And root can do any command.. */
-       if (capable(CAP_SYS_RAWIO))
-               return 0;
-
        /* Otherwise fail it with an "Operation not permitted" */
        return -EPERM;
 }