Skip to content

Commit

Permalink
Untangling ima mess, part 1: alloc_file()
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Al Viro committed Dec 16, 2009
1 parent 7715b52 commit 0552f87
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 6 deletions.
2 changes: 2 additions & 0 deletions fs/file_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 0 additions & 2 deletions fs/hugetlbfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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;

Expand Down
2 changes: 0 additions & 2 deletions ipc/shm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions mm/shmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 0552f87

Please sign in to comment.