aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-12-16 04:53:03 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-16 12:16:47 -0500
commit0552f879d45cecc35d8e372a591fc5ed863bca58 (patch)
treef3e0d76f7d5e7cf9a11ef4771294c7b4b552cd89
parent7715b521222b6ebb6e927fa261ed91ed687fe454 (diff)
Untangling ima mess, part 1: alloc_file()
There are 2 groups of alloc_file() callers: * ones that are followed by ima_counts_get * ones giving non-regular files So let's pull that ima_counts_get() into alloc_file(); it's a no-op in case of non-regular files. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/file_table.c2
-rw-r--r--fs/hugetlbfs/inode.c2
-rw-r--r--ipc/shm.c2
-rw-r--r--mm/shmem.c2
4 files changed, 2 insertions, 6 deletions
diff --git a/fs/file_table.c b/fs/file_table.c
index 361d76be8295..17a55b81be2d 100644
--- a/fs/file_table.c
+++ b/fs/file_table.c
@@ -21,6 +21,7 @@
21#include <linux/fsnotify.h> 21#include <linux/fsnotify.h>
22#include <linux/sysctl.h> 22#include <linux/sysctl.h>
23#include <linux/percpu_counter.h> 23#include <linux/percpu_counter.h>
24#include <linux/ima.h>
24 25
25#include <asm/atomic.h> 26#include <asm/atomic.h>
26 27
@@ -190,6 +191,7 @@ struct file *alloc_file(struct path *path, fmode_t mode,
190 error = mnt_clone_write(path->mnt); 191 error = mnt_clone_write(path->mnt);
191 WARN_ON(error); 192 WARN_ON(error);
192 } 193 }
194 ima_counts_get(file);
193 return file; 195 return file;
194} 196}
195 197
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c
index 6bd41525cd71..a0bbd3d1b41a 100644
--- a/fs/hugetlbfs/inode.c
+++ b/fs/hugetlbfs/inode.c
@@ -30,7 +30,6 @@
30#include <linux/dnotify.h> 30#include <linux/dnotify.h>
31#include <linux/statfs.h> 31#include <linux/statfs.h>
32#include <linux/security.h> 32#include <linux/security.h>
33#include <linux/ima.h>
34#include <linux/magic.h> 33#include <linux/magic.h>
35 34
36#include <asm/uaccess.h> 35#include <asm/uaccess.h>
@@ -971,7 +970,6 @@ struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag,
971 &hugetlbfs_file_operations); 970 &hugetlbfs_file_operations);
972 if (!file) 971 if (!file)
973 goto out_dentry; /* inode is already attached */ 972 goto out_dentry; /* inode is already attached */
974 ima_counts_get(file);
975 973
976 return file; 974 return file;
977 975
diff --git a/ipc/shm.c b/ipc/shm.c
index 16e39230aa0d..02620fae8e1f 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -39,7 +39,6 @@
39#include <linux/nsproxy.h> 39#include <linux/nsproxy.h>
40#include <linux/mount.h> 40#include <linux/mount.h>
41#include <linux/ipc_namespace.h> 41#include <linux/ipc_namespace.h>
42#include <linux/ima.h>
43 42
44#include <asm/uaccess.h> 43#include <asm/uaccess.h>
45 44
@@ -895,7 +894,6 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
895 &shm_file_operations); 894 &shm_file_operations);
896 if (!file) 895 if (!file)
897 goto out_free; 896 goto out_free;
898 ima_counts_get(file);
899 897
900 file->private_data = sfd; 898 file->private_data = sfd;
901 file->f_mapping = shp->shm_file->f_mapping; 899 file->f_mapping = shp->shm_file->f_mapping;
diff --git a/mm/shmem.c b/mm/shmem.c
index d2ec7f029ff4..adf8033afd52 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -29,7 +29,6 @@
29#include <linux/mm.h> 29#include <linux/mm.h>
30#include <linux/module.h> 30#include <linux/module.h>
31#include <linux/swap.h> 31#include <linux/swap.h>
32#include <linux/ima.h>
33 32
34static struct vfsmount *shm_mnt; 33static struct vfsmount *shm_mnt;
35 34
@@ -2669,7 +2668,6 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
2669 if (!file) 2668 if (!file)
2670 goto put_dentry; 2669 goto put_dentry;
2671 2670
2672 ima_counts_get(file);
2673 return file; 2671 return file;
2674 2672
2675put_dentry: 2673put_dentry: