Skip to content

Commit d35abdb

Browse files
author
Al Viro
committed
hold task_lock around checks in keyctl
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 6120d3d commit d35abdb

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎security/keys/keyctl.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,7 @@ long keyctl_session_to_parent(void)
14861486
oldwork = NULL;
14871487
parent = me->real_parent;
14881488

1489+
task_lock(parent);
14891490
/* the parent mustn't be init and mustn't be a kernel thread */
14901491
if (parent->pid <= 1 || !parent->mm)
14911492
goto unlock;
@@ -1529,6 +1530,7 @@ long keyctl_session_to_parent(void)
15291530
if (!ret)
15301531
newwork = NULL;
15311532
unlock:
1533+
task_unlock(parent);
15321534
write_unlock_irq(&tasklist_lock);
15331535
rcu_read_unlock();
15341536
if (oldwork)

0 commit comments

Comments
 (0)