aboutsummaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-09-02 17:16:41 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:47:12 -0400
commite915e872ed921d707bc32b3f2184d43abfa8c9e2 (patch)
tree698142e0a56622c3a3c0740522537dbff703732a /block
parent5842e51ff2e8d660756248db80ad24e4f41977d9 (diff)
[PATCH] switch sg_scsi_ioctl() to passing fmode_t
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'block')
-rw-r--r--block/scsi_ioctl.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 9a441559118d..375e25df8adc 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -379,12 +379,11 @@ out:
379 * bytes in one int) where the lowest byte is the SCSI status. 379 * bytes in one int) where the lowest byte is the SCSI status.
380 */ 380 */
381#define OMAX_SB_LEN 16 /* For backward compatibility */ 381#define OMAX_SB_LEN 16 /* For backward compatibility */
382int sg_scsi_ioctl(struct file *file, struct request_queue *q, 382int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
383 struct gendisk *disk, struct scsi_ioctl_command __user *sic) 383 struct scsi_ioctl_command __user *sic)
384{ 384{
385 struct request *rq; 385 struct request *rq;
386 int err; 386 int err;
387 fmode_t write_perm = 0;
388 unsigned int in_len, out_len, bytes, opcode, cmdlen; 387 unsigned int in_len, out_len, bytes, opcode, cmdlen;
389 char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE]; 388 char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE];
390 389
@@ -426,11 +425,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,
426 if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len)) 425 if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len))
427 goto error; 426 goto error;
428 427
429 /* scsi_ioctl passes NULL */ 428 err = blk_verify_command(&q->cmd_filter, rq->cmd, mode & FMODE_WRITE);
430 if (file && (file->f_mode & FMODE_WRITE))
431 write_perm = FMODE_WRITE;
432
433 err = blk_verify_command(&q->cmd_filter, rq->cmd, write_perm);
434 if (err) 429 if (err)
435 goto error; 430 goto error;
436 431
@@ -636,7 +631,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
636 if (!arg) 631 if (!arg)
637 break; 632 break;
638 633
639 err = sg_scsi_ioctl(file, q, bd_disk, arg); 634 err = sg_scsi_ioctl(q, bd_disk, file ? file->f_mode : 0, arg);
640 break; 635 break;
641 case CDROMCLOSETRAY: 636 case CDROMCLOSETRAY:
642 err = blk_send_start_stop(q, bd_disk, 0x03); 637 err = blk_send_start_stop(q, bd_disk, 0x03);