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
5a57be8d
Commit
5a57be8d
authored
Jan 09, 2006
by
Jens Axboe
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[BLOCK] scsi_ioctl: file can be NULL from ioctl_by_bdev()
Signed-off-by:
Jens Axboe
<
axboe@suse.de
>
parent
0ea60b5a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
4 deletions
+9
-4
block/scsi_ioctl.c
block/scsi_ioctl.c
+9
-4
No files found.
block/scsi_ioctl.c
View file @
5a57be8d
...
@@ -190,16 +190,21 @@ static int verify_command(struct file *file, unsigned char *cmd)
...
@@ -190,16 +190,21 @@ static int verify_command(struct file *file, unsigned char *cmd)
safe_for_write
(
GPCMD_SET_STREAMING
),
safe_for_write
(
GPCMD_SET_STREAMING
),
};
};
unsigned
char
type
=
cmd_type
[
cmd
[
0
]];
unsigned
char
type
=
cmd_type
[
cmd
[
0
]];
int
has_write_perm
=
0
;
/* Anybody who can open the device can do a read-safe command */
/* Anybody who can open the device can do a read-safe command */
if
(
type
&
CMD_READ_SAFE
)
if
(
type
&
CMD_READ_SAFE
)
return
0
;
return
0
;
/*
* file can be NULL from ioctl_by_bdev()...
*/
if
(
file
)
has_write_perm
=
file
->
f_mode
&
FMODE_WRITE
;
/* Write-safe commands just require a writable open.. */
/* Write-safe commands just require a writable open.. */
if
(
type
&
CMD_WRITE_SAFE
)
{
if
((
type
&
CMD_WRITE_SAFE
)
&&
has_write_perm
)
if
(
file
->
f_mode
&
FMODE_WRITE
)
return
0
;
return
0
;
}
/* And root can do any command.. */
/* And root can do any command.. */
if
(
capable
(
CAP_SYS_RAWIO
))
if
(
capable
(
CAP_SYS_RAWIO
))
...
...
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