Skip to content

Commit 0552f87

Browse files
author
Al Viro
committed
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>
1 parent 7715b52 commit 0552f87

4 files changed

Lines changed: 2 additions & 6 deletions

File tree

‎fs/file_table.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <linux/fsnotify.h>
2222
#include <linux/sysctl.h>
2323
#include <linux/percpu_counter.h>
24+
#include <linux/ima.h>
2425

2526
#include <asm/atomic.h>
2627

@@ -190,6 +191,7 @@ struct file *alloc_file(struct path *path, fmode_t mode,
190191
error = mnt_clone_write(path->mnt);
191192
WARN_ON(error);
192193
}
194+
ima_counts_get(file);
193195
return file;
194196
}
195197

‎fs/hugetlbfs/inode.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <linux/dnotify.h>
3131
#include <linux/statfs.h>
3232
#include <linux/security.h>
33-
#include <linux/ima.h>
3433
#include <linux/magic.h>
3534

3635
#include <asm/uaccess.h>
@@ -971,7 +970,6 @@ struct file *hugetlb_file_setup(const char *name, size_t size, int acctflag,
971970
&hugetlbfs_file_operations);
972971
if (!file)
973972
goto out_dentry; /* inode is already attached */
974-
ima_counts_get(file);
975973

976974
return file;
977975

‎ipc/shm.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
#include <linux/nsproxy.h>
4040
#include <linux/mount.h>
4141
#include <linux/ipc_namespace.h>
42-
#include <linux/ima.h>
4342

4443
#include <asm/uaccess.h>
4544

@@ -895,7 +894,6 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
895894
&shm_file_operations);
896895
if (!file)
897896
goto out_free;
898-
ima_counts_get(file);
899897

900898
file->private_data = sfd;
901899
file->f_mapping = shp->shm_file->f_mapping;

‎mm/shmem.c‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#include <linux/mm.h>
3030
#include <linux/module.h>
3131
#include <linux/swap.h>
32-
#include <linux/ima.h>
3332

3433
static struct vfsmount *shm_mnt;
3534

@@ -2669,7 +2668,6 @@ struct file *shmem_file_setup(const char *name, loff_t size, unsigned long flags
26692668
if (!file)
26702669
goto put_dentry;
26712670

2672-
ima_counts_get(file);
26732671
return file;
26742672

26752673
put_dentry:

0 commit comments

Comments
 (0)