aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/shm.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/shm.c')
-rw-r--r--ipc/shm.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index e9b039f74129..92fe9236258b 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
@@ -879,8 +878,8 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
879 if (err) 878 if (err)
880 goto out_unlock; 879 goto out_unlock;
881 880
882 path.dentry = dget(shp->shm_file->f_path.dentry); 881 path = shp->shm_file->f_path;
883 path.mnt = shp->shm_file->f_path.mnt; 882 path_get(&path);
884 shp->shm_nattch++; 883 shp->shm_nattch++;
885 size = i_size_read(path.dentry->d_inode); 884 size = i_size_read(path.dentry->d_inode);
886 shm_unlock(shp); 885 shm_unlock(shp);
@@ -890,13 +889,12 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
890 if (!sfd) 889 if (!sfd)
891 goto out_put_dentry; 890 goto out_put_dentry;
892 891
893 file = alloc_file(path.mnt, path.dentry, f_mode, 892 file = alloc_file(&path, f_mode,
894 is_file_hugepages(shp->shm_file) ? 893 is_file_hugepages(shp->shm_file) ?
895 &shm_file_operations_huge : 894 &shm_file_operations_huge :
896 &shm_file_operations); 895 &shm_file_operations);
897 if (!file) 896 if (!file)
898 goto out_free; 897 goto out_free;
899 ima_counts_get(file);
900 898
901 file->private_data = sfd; 899 file->private_data = sfd;
902 file->f_mapping = shp->shm_file->f_mapping; 900 file->f_mapping = shp->shm_file->f_mapping;
@@ -951,7 +949,7 @@ out_unlock:
951out_free: 949out_free:
952 kfree(sfd); 950 kfree(sfd);
953out_put_dentry: 951out_put_dentry:
954 dput(path.dentry); 952 path_put(&path);
955 goto out_nattch; 953 goto out_nattch;
956} 954}
957 955