aboutsummaryrefslogtreecommitdiffstats
path: root/security/selinux
diff options
context:
space:
mode:
authorStephen Smalley <sds@tycho.nsa.gov>2007-11-21 09:01:36 -0500
committerJames Morris <jmorris@namei.org>2007-12-05 08:23:46 -0500
commit0955dc03aedfb6a5565445b3f2176255b784cc6a (patch)
tree34ec01676c33f5627b8a5c02ca68b8757da3308c /security/selinux
parente3c0ac04f980750a368f7cd5f1b8d1d2cdc1f735 (diff)
SELinux: do not clear f_op when removing entries
Do not clear f_op when removing entries since it isn't safe to do. Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'security/selinux')
-rw-r--r--security/selinux/selinuxfs.c28
1 files changed, 1 insertions, 27 deletions
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index f5f3e6da5da7..ac6fe99bd32c 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -838,10 +838,6 @@ static ssize_t sel_read_bool(struct file *filep, char __user *buf,
838 838
839 ret = -EFAULT; 839 ret = -EFAULT;
840 840
841 /* check to see if this file has been deleted */
842 if (!filep->f_op)
843 goto out;
844
845 if (count > PAGE_SIZE) { 841 if (count > PAGE_SIZE) {
846 ret = -EINVAL; 842 ret = -EINVAL;
847 goto out; 843 goto out;
@@ -882,10 +878,6 @@ static ssize_t sel_write_bool(struct file *filep, const char __user *buf,
882 if (length) 878 if (length)
883 goto out; 879 goto out;
884 880
885 /* check to see if this file has been deleted */
886 if (!filep->f_op)
887 goto out;
888
889 if (count >= PAGE_SIZE) { 881 if (count >= PAGE_SIZE) {
890 length = -ENOMEM; 882 length = -ENOMEM;
891 goto out; 883 goto out;
@@ -940,10 +932,6 @@ static ssize_t sel_commit_bools_write(struct file *filep,
940 if (length) 932 if (length)
941 goto out; 933 goto out;
942 934
943 /* check to see if this file has been deleted */
944 if (!filep->f_op)
945 goto out;
946
947 if (count >= PAGE_SIZE) { 935 if (count >= PAGE_SIZE) {
948 length = -ENOMEM; 936 length = -ENOMEM;
949 goto out; 937 goto out;
@@ -982,11 +970,9 @@ static const struct file_operations sel_commit_bools_ops = {
982 .write = sel_commit_bools_write, 970 .write = sel_commit_bools_write,
983}; 971};
984 972
985/* partial revoke() from fs/proc/generic.c proc_kill_inodes */
986static void sel_remove_entries(struct dentry *de) 973static void sel_remove_entries(struct dentry *de)
987{ 974{
988 struct list_head *p, *node; 975 struct list_head *node;
989 struct super_block *sb = de->d_sb;
990 976
991 spin_lock(&dcache_lock); 977 spin_lock(&dcache_lock);
992 node = de->d_subdirs.next; 978 node = de->d_subdirs.next;
@@ -1006,18 +992,6 @@ static void sel_remove_entries(struct dentry *de)
1006 } 992 }
1007 993
1008 spin_unlock(&dcache_lock); 994 spin_unlock(&dcache_lock);
1009
1010 file_list_lock();
1011 list_for_each(p, &sb->s_files) {
1012 struct file * filp = list_entry(p, struct file, f_u.fu_list);
1013 struct dentry * dentry = filp->f_path.dentry;
1014
1015 if (dentry->d_parent != de) {
1016 continue;
1017 }
1018 filp->f_op = NULL;
1019 }
1020 file_list_unlock();
1021} 995}
1022 996
1023#define BOOL_DIR_NAME "booleans" 997#define BOOL_DIR_NAME "booleans"