mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
selinux: handle files opened with flags 3 by checking ioctl permission
Handle files opened with flags 3 by checking ioctl permission. Default to returning FILE__IOCTL from file_to_av() if the f_mode has neither FMODE_READ nor FMODE_WRITE, and thus check ioctl permission on exec or transfer, thereby validating such descriptors early as with normal r/w descriptors and catching leaks of them prior to attempted usage. Signed-off-by: Stephen Smalley <[email protected]> Acked-by: Eric Paris <[email protected]> Signed-off-by: James Morris <[email protected]>
This commit is contained in:
parent
0e81a8ae37
commit
0794c66d49
1 changed files with 6 additions and 0 deletions
|
|
@ -1630,6 +1630,12 @@ static inline u32 file_to_av(struct file *file)
|
|||
else
|
||||
av |= FILE__WRITE;
|
||||
}
|
||||
if (!av) {
|
||||
/*
|
||||
* Special file opened with flags 3 for ioctl-only use.
|
||||
*/
|
||||
av = FILE__IOCTL;
|
||||
}
|
||||
|
||||
return av;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue