Skip to content

Commit 3b0e77b

Browse files
Jens AxboeLinus Torvalds
authored andcommitted
[PATCH] scsi_ioctl: only warn for rejected commands
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>
1 parent 8aa19ad commit 3b0e77b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

‎drivers/block/scsi_ioctl.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -201,15 +201,15 @@ static int verify_command(struct file *file, unsigned char *cmd)
201201
return 0;
202202
}
203203

204+
/* And root can do any command.. */
205+
if (capable(CAP_SYS_RAWIO))
206+
return 0;
207+
204208
if (!type) {
205209
cmd_type[cmd[0]] = CMD_WARNED;
206210
printk(KERN_WARNING "scsi: unknown opcode 0x%02x\n", cmd[0]);
207211
}
208212

209-
/* And root can do any command.. */
210-
if (capable(CAP_SYS_RAWIO))
211-
return 0;
212-
213213
/* Otherwise fail it with an "Operation not permitted" */
214214
return -EPERM;
215215
}

0 commit comments

Comments
 (0)