summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2009-12-16 10:53:03 +0100
committerAl Viro <viro@zeniv.linux.org.uk>2009-12-16 18:16:47 +0100
commit0552f879d45cecc35d8e372a591fc5ed863bca58 (patch)
treef3e0d76f7d5e7cf9a11ef4771294c7b4b552cd89
parentO_TRUNC open shouldn't fail after file truncation (diff)
downloadlinux-0552f879d45cecc35d8e372a591fc5ed863bca58.tar.xz
linux-0552f879d45cecc35d8e372a591fc5ed863bca58.zip
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 @@
#include <linux/fsnotify.h>
#include <linux/sysctl.h>
#include <linux/percpu_counter.h>
+#include <linux/ima.h>
#include <asm/atomic.h>
@@ -190,6 +191,7 @@ struct file *alloc_file(struct path *path, fmode_t mode,
error = mnt_clone_write(path->mnt);
WARN_ON(error);
}
+ ima_counts_get(file);
return file;
}
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 @@
#include <linux/dnotify.h>
#include <linux/statfs.h>
#include <linux/security.h>
-#include <linux/ima.h>
#include <linux/magic.h>
#include <asm/uaccess.h>
@@ -971,7 +970,6 @@ struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag,
&hugetlbfs_file_operations);
if (!file)
goto out_dentry; /* inode is already attached */
- ima_counts_get(file);
return file;
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 @@
#include <linux/nsproxy.h>
#include <linux/mount.h>
#include <linux/ipc_namespace.h>
-#include <linux/ima.h>
#include <asm/uaccess.h>
@@ -895,7 +894,6 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
&shm_file_operations);
if (!file)
goto out_free;
- ima_counts_get(file);
file->private_data = sfd;
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 @@
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/swap.h>
-#include <linux/ima.h>
static struct vfsmount *shm_mnt;
@@ -2669,7 +2668,6 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
if (!file)
goto put_dentry;
- ima_counts_get(file);
return file;
put_dentry: