diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-05-30 17:11:23 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-06-01 10:37:01 -0400 |
commit | 8b3ec6814c83d76b85bd13badc48552836c24839 (patch) | |
tree | 2430a4511c7ea41f67b0d841f4c42eac43828db3 /ipc/shm.c | |
parent | e5467859f7f79b69fc49004403009dfdba3bec53 (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.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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(¤t->mm->mmap_sem); | 1043 | down_write(¤t->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) | |||
1058 | invalid: | 1062 | invalid: |
1059 | up_write(¤t->mm->mmap_sem); | 1063 | up_write(¤t->mm->mmap_sem); |
1060 | 1064 | ||
1065 | out_fput: | ||
1061 | fput(file); | 1066 | fput(file); |
1062 | 1067 | ||
1063 | out_nattch: | 1068 | out_nattch: |