diff options
Diffstat (limited to 'security/selinux/hooks.c')
-rw-r--r-- | security/selinux/hooks.c | 24 |
1 files changed, 3 insertions, 21 deletions
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 650947a72a2b..9b40f4c0ac70 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -1776,27 +1776,9 @@ static inline u32 open_file_to_av(struct file *file) | |||
1776 | { | 1776 | { |
1777 | u32 av = file_to_av(file); | 1777 | u32 av = file_to_av(file); |
1778 | 1778 | ||
1779 | if (selinux_policycap_openperm) { | 1779 | if (selinux_policycap_openperm) |
1780 | mode_t mode = file->f_path.dentry->d_inode->i_mode; | 1780 | av |= FILE__OPEN; |
1781 | /* | 1781 | |
1782 | * lnk files and socks do not really have an 'open' | ||
1783 | */ | ||
1784 | if (S_ISREG(mode)) | ||
1785 | av |= FILE__OPEN; | ||
1786 | else if (S_ISCHR(mode)) | ||
1787 | av |= CHR_FILE__OPEN; | ||
1788 | else if (S_ISBLK(mode)) | ||
1789 | av |= BLK_FILE__OPEN; | ||
1790 | else if (S_ISFIFO(mode)) | ||
1791 | av |= FIFO_FILE__OPEN; | ||
1792 | else if (S_ISDIR(mode)) | ||
1793 | av |= DIR__OPEN; | ||
1794 | else if (S_ISSOCK(mode)) | ||
1795 | av |= SOCK_FILE__OPEN; | ||
1796 | else | ||
1797 | printk(KERN_ERR "SELinux: WARNING: inside %s with " | ||
1798 | "unknown mode:%o\n", __func__, mode); | ||
1799 | } | ||
1800 | return av; | 1782 | return av; |
1801 | } | 1783 | } |
1802 | 1784 | ||