Skip to content

Commit

Permalink
hold task_lock around checks in keyctl
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jul 22, 2012
1 parent 6120d3d commit d35abdb
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions security/keys/keyctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1486,6 +1486,7 @@ long keyctl_session_to_parent(void)
oldwork = NULL;
parent = me->real_parent;

task_lock(parent);
/* the parent mustn't be init and mustn't be a kernel thread */
if (parent->pid <= 1 || !parent->mm)
goto unlock;
Expand Down Expand Up @@ -1529,6 +1530,7 @@ long keyctl_session_to_parent(void)
if (!ret)
newwork = NULL;
unlock:
task_unlock(parent);
write_unlock_irq(&tasklist_lock);
rcu_read_unlock();
if (oldwork)
Expand Down

0 comments on commit d35abdb

Please sign in to comment.