Commit f0fa2bcc authored by Jens Axboe's avatar Jens Axboe Committed by Linus Torvalds

[PATCH] warn once for unknown SCSI command

Warn once for each unknown command sent through SG_IO or the old SCSI
command ioctl.
Signed-off-by: default avatarJens Axboe <axboe@suse.de>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent bd5531b4
......@@ -107,12 +107,13 @@ static int sg_emulated_host(request_queue_t *q, int __user *p)
#define CMD_READ_SAFE 0x01
#define CMD_WRITE_SAFE 0x02
#define CMD_WARNED 0x04
#define safe_for_read(cmd) [cmd] = CMD_READ_SAFE
#define safe_for_write(cmd) [cmd] = CMD_WRITE_SAFE
static int verify_command(struct file *file, unsigned char *cmd)
{
static const unsigned char cmd_type[256] = {
static unsigned char cmd_type[256] = {
/* Basic read-only commands */
safe_for_read(TEST_UNIT_READY),
......@@ -197,6 +198,11 @@ static int verify_command(struct file *file, unsigned char *cmd)
return 0;
}
if (!(type & CMD_WARNED)) {
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment