diff options
Diffstat (limited to 'block/scsi_ioctl.c')
-rw-r--r-- | block/scsi_ioctl.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c index daded70ffbb1..db53b2c268d3 100644 --- a/block/scsi_ioctl.c +++ b/block/scsi_ioctl.c | |||
@@ -112,7 +112,7 @@ static int sg_emulated_host(request_queue_t *q, int __user *p) | |||
112 | #define safe_for_read(cmd) [cmd] = CMD_READ_SAFE | 112 | #define safe_for_read(cmd) [cmd] = CMD_READ_SAFE |
113 | #define safe_for_write(cmd) [cmd] = CMD_WRITE_SAFE | 113 | #define safe_for_write(cmd) [cmd] = CMD_WRITE_SAFE |
114 | 114 | ||
115 | static int verify_command(unsigned char *cmd, int has_write_perm) | 115 | int blk_verify_command(unsigned char *cmd, int has_write_perm) |
116 | { | 116 | { |
117 | static unsigned char cmd_type[256] = { | 117 | static unsigned char cmd_type[256] = { |
118 | 118 | ||
@@ -212,6 +212,7 @@ static int verify_command(unsigned char *cmd, int has_write_perm) | |||
212 | /* Otherwise fail it with an "Operation not permitted" */ | 212 | /* Otherwise fail it with an "Operation not permitted" */ |
213 | return -EPERM; | 213 | return -EPERM; |
214 | } | 214 | } |
215 | EXPORT_SYMBOL_GPL(blk_verify_command); | ||
215 | 216 | ||
216 | int blk_fill_sghdr_rq(request_queue_t *q, struct request *rq, | 217 | int blk_fill_sghdr_rq(request_queue_t *q, struct request *rq, |
217 | struct sg_io_hdr *hdr, int has_write_perm) | 218 | struct sg_io_hdr *hdr, int has_write_perm) |
@@ -220,7 +221,7 @@ int blk_fill_sghdr_rq(request_queue_t *q, struct request *rq, | |||
220 | 221 | ||
221 | if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len)) | 222 | if (copy_from_user(rq->cmd, hdr->cmdp, hdr->cmd_len)) |
222 | return -EFAULT; | 223 | return -EFAULT; |
223 | if (verify_command(rq->cmd, has_write_perm)) | 224 | if (blk_verify_command(rq->cmd, has_write_perm)) |
224 | return -EPERM; | 225 | return -EPERM; |
225 | 226 | ||
226 | /* | 227 | /* |
@@ -457,7 +458,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q, | |||
457 | if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len)) | 458 | if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len)) |
458 | goto error; | 459 | goto error; |
459 | 460 | ||
460 | err = verify_command(rq->cmd, file->f_mode & FMODE_WRITE); | 461 | err = blk_verify_command(rq->cmd, file->f_mode & FMODE_WRITE); |
461 | if (err) | 462 | if (err) |
462 | goto error; | 463 | goto error; |
463 | 464 | ||