diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/locks.c | 2 | ||||
-rw-r--r-- | fs/proc/base.c | 23 |
2 files changed, 12 insertions, 13 deletions
diff --git a/fs/locks.c b/fs/locks.c index b6440f52178f..52366e877d76 100644 --- a/fs/locks.c +++ b/fs/locks.c | |||
@@ -1591,7 +1591,7 @@ SYSCALL_DEFINE2(flock, unsigned int, fd, unsigned int, cmd) | |||
1591 | if (can_sleep) | 1591 | if (can_sleep) |
1592 | lock->fl_flags |= FL_SLEEP; | 1592 | lock->fl_flags |= FL_SLEEP; |
1593 | 1593 | ||
1594 | error = security_file_lock(filp, cmd); | 1594 | error = security_file_lock(filp, lock->fl_type); |
1595 | if (error) | 1595 | if (error) |
1596 | goto out_free; | 1596 | goto out_free; |
1597 | 1597 | ||
diff --git a/fs/proc/base.c b/fs/proc/base.c index 3ce5ae9e3d2d..917f338a6739 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -237,20 +237,19 @@ struct mm_struct *mm_for_maps(struct task_struct *task) | |||
237 | struct mm_struct *mm = get_task_mm(task); | 237 | struct mm_struct *mm = get_task_mm(task); |
238 | if (!mm) | 238 | if (!mm) |
239 | return NULL; | 239 | return NULL; |
240 | if (mm != current->mm) { | ||
241 | /* | ||
242 | * task->mm can be changed before security check, | ||
243 | * in that case we must notice the change after. | ||
244 | */ | ||
245 | if (!ptrace_may_access(task, PTRACE_MODE_READ) || | ||
246 | mm != task->mm) { | ||
247 | mmput(mm); | ||
248 | return NULL; | ||
249 | } | ||
250 | } | ||
240 | down_read(&mm->mmap_sem); | 251 | down_read(&mm->mmap_sem); |
241 | task_lock(task); | ||
242 | if (task->mm != mm) | ||
243 | goto out; | ||
244 | if (task->mm != current->mm && | ||
245 | __ptrace_may_access(task, PTRACE_MODE_READ) < 0) | ||
246 | goto out; | ||
247 | task_unlock(task); | ||
248 | return mm; | 252 | return mm; |
249 | out: | ||
250 | task_unlock(task); | ||
251 | up_read(&mm->mmap_sem); | ||
252 | mmput(mm); | ||
253 | return NULL; | ||
254 | } | 253 | } |
255 | 254 | ||
256 | static int proc_pid_cmdline(struct task_struct *task, char * buffer) | 255 | static int proc_pid_cmdline(struct task_struct *task, char * buffer) |