Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 117495
b: refs/heads/master
c: e915e87
h: refs/heads/master
i:
  117493: 114951c
  117491: 2d2b148
  117487: 7d588b0
v: v3
  • Loading branch information
Al Viro committed Oct 21, 2008
1 parent c99883a commit 7b23ede
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5842e51ff2e8d660756248db80ad24e4f41977d9
refs/heads/master: e915e872ed921d707bc32b3f2184d43abfa8c9e2
13 changes: 4 additions & 9 deletions trunk/block/scsi_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,12 +379,11 @@ static int sg_io(struct request_queue *q, struct gendisk *bd_disk,
* bytes in one int) where the lowest byte is the SCSI status.
*/
#define OMAX_SB_LEN 16 /* For backward compatibility */
int sg_scsi_ioctl(struct file *file, struct request_queue *q,
struct gendisk *disk, struct scsi_ioctl_command __user *sic)
int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
struct scsi_ioctl_command __user *sic)
{
struct request *rq;
int err;
fmode_t write_perm = 0;
unsigned int in_len, out_len, bytes, opcode, cmdlen;
char *buffer = NULL, sense[SCSI_SENSE_BUFFERSIZE];

Expand Down Expand Up @@ -426,11 +425,7 @@ int sg_scsi_ioctl(struct file *file, struct request_queue *q,
if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len))
goto error;

/* scsi_ioctl passes NULL */
if (file && (file->f_mode & FMODE_WRITE))
write_perm = FMODE_WRITE;

err = blk_verify_command(&q->cmd_filter, rq->cmd, write_perm);
err = blk_verify_command(&q->cmd_filter, rq->cmd, mode & FMODE_WRITE);
if (err)
goto error;

Expand Down Expand Up @@ -636,7 +631,7 @@ int scsi_cmd_ioctl(struct file *file, struct request_queue *q,
if (!arg)
break;

err = sg_scsi_ioctl(file, q, bd_disk, arg);
err = sg_scsi_ioctl(q, bd_disk, file ? file->f_mode : 0, arg);
break;
case CDROMCLOSETRAY:
err = blk_send_start_stop(q, bd_disk, 0x03);
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/scsi_ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ int scsi_ioctl(struct scsi_device *sdev, int cmd, void __user *arg)
case SCSI_IOCTL_SEND_COMMAND:
if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO))
return -EACCES;
return sg_scsi_ioctl(NULL, sdev->request_queue, NULL, arg);
return sg_scsi_ioctl(sdev->request_queue, NULL, 0, arg);
case SCSI_IOCTL_DOORLOCK:
return scsi_set_medium_removal(sdev, SCSI_REMOVAL_PREVENT);
case SCSI_IOCTL_DOORUNLOCK:
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/sg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ sg_ioctl(struct inode *inode, struct file *filp,
if (sg_allow_access(filp, &opcode))
return -EPERM;
}
return sg_scsi_ioctl(filp, sdp->device->request_queue, NULL, p);
return sg_scsi_ioctl(sdp->device->request_queue, NULL, filp->f_mode, p);
case SG_SET_DEBUG:
result = get_user(val, ip);
if (result)
Expand Down
4 changes: 2 additions & 2 deletions trunk/include/linux/blkdev.h
Original file line number Diff line number Diff line change
Expand Up @@ -719,8 +719,8 @@ extern int blk_remove_plug(struct request_queue *);
extern void blk_recount_segments(struct request_queue *, struct bio *);
extern int scsi_cmd_ioctl(struct file *, struct request_queue *,
struct gendisk *, unsigned int, void __user *);
extern int sg_scsi_ioctl(struct file *, struct request_queue *,
struct gendisk *, struct scsi_ioctl_command __user *);
extern int sg_scsi_ioctl(struct request_queue *, struct gendisk *, fmode_t,
struct scsi_ioctl_command __user *);

/*
* Temporary export, until SCSI gets fixed up.
Expand Down

0 comments on commit 7b23ede

Please sign in to comment.