summaryrefslogtreecommitdiffstats
path: root/block/scsi_ioctl.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-11-05 02:36:31 -0500
committerJens Axboe <axboe@kernel.dk>2017-11-10 21:53:25 -0500
commitf00c4d80ffdac9e3a64947ebd57489f3232d5a74 (patch)
tree1af98eb6b73480a69a2ff951dd7d8b68604aeaa3 /block/scsi_ioctl.c
parentd004a5e7d4dd6335ce6e2044af42f5e0fbebb51d (diff)
block: pass full fmode_t to blk_verify_command
Use the obvious calling convention. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/scsi_ioctl.c')
-rw-r--r--block/scsi_ioctl.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/block/scsi_ioctl.c b/block/scsi_ioctl.c
index 7440de44dd85..edcfff974527 100644
--- a/block/scsi_ioctl.c
+++ b/block/scsi_ioctl.c
@@ -207,7 +207,7 @@ static void blk_set_cmd_filter_defaults(struct blk_cmd_filter *filter)
207 __set_bit(GPCMD_SET_READ_AHEAD, filter->write_ok); 207 __set_bit(GPCMD_SET_READ_AHEAD, filter->write_ok);
208} 208}
209 209
210int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm) 210int blk_verify_command(unsigned char *cmd, fmode_t mode)
211{ 211{
212 struct blk_cmd_filter *filter = &blk_default_cmd_filter; 212 struct blk_cmd_filter *filter = &blk_default_cmd_filter;
213 213
@@ -220,7 +220,7 @@ int blk_verify_command(unsigned char *cmd, fmode_t has_write_perm)
220 return 0; 220 return 0;
221 221
222 /* Write-safe commands require a writable open */ 222 /* Write-safe commands require a writable open */
223 if (test_bit(cmd[0], filter->write_ok) && has_write_perm) 223 if (test_bit(cmd[0], filter->write_ok) && (mode & FMODE_WRITE))
224 return 0; 224 return 0;
225 225
226 return -EPERM; 226 return -EPERM;
@@ -234,7 +234,7 @@ static int blk_fill_sghdr_rq(struct request_queue *q, struct request *rq,
234 234
235 if (copy_from_user(req->cmd, hdr->cmdp, hdr->cmd_len)) 235 if (copy_from_user(req->cmd, hdr->cmdp, hdr->cmd_len))
236 return -EFAULT; 236 return -EFAULT;
237 if (blk_verify_command(req->cmd, mode & FMODE_WRITE)) 237 if (blk_verify_command(req->cmd, mode))
238 return -EPERM; 238 return -EPERM;
239 239
240 /* 240 /*
@@ -469,7 +469,7 @@ int sg_scsi_ioctl(struct request_queue *q, struct gendisk *disk, fmode_t mode,
469 if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len)) 469 if (in_len && copy_from_user(buffer, sic->data + cmdlen, in_len))
470 goto error; 470 goto error;
471 471
472 err = blk_verify_command(req->cmd, mode & FMODE_WRITE); 472 err = blk_verify_command(req->cmd, mode);
473 if (err) 473 if (err)
474 goto error; 474 goto error;
475 475