diff options
-rw-r--r-- | block/scsi_ioctl.c | 7 | ||||
-rw-r--r-- | include/linux/blkdev.h | 1 |
2 files changed, 5 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 | ||
diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index 53002d40efa2..f6bc0d03ffad 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h | |||
@@ -692,6 +692,7 @@ extern int blk_fill_sghdr_rq(request_queue_t *, struct request *, | |||
692 | extern int blk_unmap_sghdr_rq(struct request *, struct sg_io_hdr *); | 692 | extern int blk_unmap_sghdr_rq(struct request *, struct sg_io_hdr *); |
693 | extern int blk_complete_sghdr_rq(struct request *, struct sg_io_hdr *, | 693 | extern int blk_complete_sghdr_rq(struct request *, struct sg_io_hdr *, |
694 | struct bio *); | 694 | struct bio *); |
695 | extern int blk_verify_command(unsigned char *, int); | ||
695 | 696 | ||
696 | static inline request_queue_t *bdev_get_queue(struct block_device *bdev) | 697 | static inline request_queue_t *bdev_get_queue(struct block_device *bdev) |
697 | { | 698 | { |