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, 7 insertions, 5 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index 4fa6d8fee730..be3ec9ae454e 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -967,11 +967,11 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr,
967 unsigned long flags; 967 unsigned long flags;
968 unsigned long prot; 968 unsigned long prot;
969 int acc_mode; 969 int acc_mode;
970 unsigned long user_addr;
971 struct ipc_namespace *ns; 970 struct ipc_namespace *ns;
972 struct shm_file_data *sfd; 971 struct shm_file_data *sfd;
973 struct path path; 972 struct path path;
974 fmode_t f_mode; 973 fmode_t f_mode;
974 unsigned long populate = 0;
975 975
976 err = -EINVAL; 976 err = -EINVAL;
977 if (shmid < 0) 977 if (shmid < 0)
@@ -1070,13 +1070,15 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr,
1070 goto invalid; 1070 goto invalid;
1071 } 1071 }
1072 1072
1073 user_addr = do_mmap_pgoff(file, addr, size, prot, flags, 0); 1073 addr = do_mmap_pgoff(file, addr, size, prot, flags, 0, &populate);
1074 *raddr = user_addr; 1074 *raddr = addr;
1075 err = 0; 1075 err = 0;
1076 if (IS_ERR_VALUE(user_addr)) 1076 if (IS_ERR_VALUE(addr))
1077 err = (long)user_addr; 1077 err = (long)addr;
1078invalid: 1078invalid:
1079 up_write(&current->mm->mmap_sem); 1079 up_write(&current->mm->mmap_sem);
1080 if (populate)
1081 mm_populate(addr, populate);
1080 1082
1081out_fput: 1083out_fput:
1082 fput(file); 1084 fput(file);