Commit d35abdb28824cf74f0a106a0f9c6f3ff700a35bf
1 parent
6120d3dbb1
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
hold task_lock around checks in keyctl
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff
security/keys/keyctl.c
... | ... | @@ -1486,6 +1486,7 @@ |
1486 | 1486 | oldwork = NULL; |
1487 | 1487 | parent = me->real_parent; |
1488 | 1488 | |
1489 | + task_lock(parent); | |
1489 | 1490 | /* the parent mustn't be init and mustn't be a kernel thread */ |
1490 | 1491 | if (parent->pid <= 1 || !parent->mm) |
1491 | 1492 | goto unlock; |
... | ... | @@ -1529,6 +1530,7 @@ |
1529 | 1530 | if (!ret) |
1530 | 1531 | newwork = NULL; |
1531 | 1532 | unlock: |
1533 | + task_unlock(parent); | |
1532 | 1534 | write_unlock_irq(&tasklist_lock); |
1533 | 1535 | rcu_read_unlock(); |
1534 | 1536 | if (oldwork) |