aboutsummaryrefslogtreecommitdiffstats
path: root/ipc/shm.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-05-30 17:11:23 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-06-01 10:37:01 -0400
commit8b3ec6814c83d76b85bd13badc48552836c24839 (patch)
tree2430a4511c7ea41f67b0d841f4c42eac43828db3 /ipc/shm.c
parente5467859f7f79b69fc49004403009dfdba3bec53 (diff)
take security_mmap_file() outside of ->mmap_sem
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'ipc/shm.c')
-rw-r--r--ipc/shm.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/ipc/shm.c b/ipc/shm.c
index 406c5b208193..e3a8063b1768 100644
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -1036,6 +1036,10 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
1036 sfd->file = shp->shm_file; 1036 sfd->file = shp->shm_file;
1037 sfd->vm_ops = NULL; 1037 sfd->vm_ops = NULL;
1038 1038
1039 err = security_mmap_file(file, prot, flags);
1040 if (err)
1041 goto out_fput;
1042
1039 down_write(&current->mm->mmap_sem); 1043 down_write(&current->mm->mmap_sem);
1040 if (addr && !(shmflg & SHM_REMAP)) { 1044 if (addr && !(shmflg & SHM_REMAP)) {
1041 err = -EINVAL; 1045 err = -EINVAL;
@@ -1058,6 +1062,7 @@ long do_shmat(int shmid, char __user *shmaddr, int shmflg, ulong *raddr)
1058invalid: 1062invalid:
1059 up_write(&current->mm->mmap_sem); 1063 up_write(&current->mm->mmap_sem);
1060 1064
1065out_fput:
1061 fput(file); 1066 fput(file);
1062 1067
1063out_nattch: 1068out_nattch: