Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
e915e872
Commit
e915e872
authored
Sep 02, 2008
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[PATCH] switch sg_scsi_ioctl() to passing fmode_t
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
5842e51f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
8 additions
and
13 deletions
+8
-13
block/scsi_ioctl.c
block/scsi_ioctl.c
+4
-9
drivers/scsi/scsi_ioctl.c
drivers/scsi/scsi_ioctl.c
+1
-1
drivers/scsi/sg.c
drivers/scsi/sg.c
+1
-1
include/linux/blkdev.h
include/linux/blkdev.h
+2
-2
No files found.
block/scsi_ioctl.c
View file @
e915e872
...
...
@@ -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
];
...
...
@@ -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
;
...
...
@@ -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
);
...
...
drivers/scsi/scsi_ioctl.c
View file @
e915e872
...
...
@@ -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
:
...
...
drivers/scsi/sg.c
View file @
e915e872
...
...
@@ -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
)
...
...
include/linux/blkdev.h
View file @
e915e872
...
...
@@ -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.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment