summaryrefslogtreecommitdiff
path: root/kernel/pid.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-12-15 19:36:48 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-15 19:36:48 -0800
commitd01e7f10dae29eba0f9ada82b65d24e035d5b2f9 (patch)
tree5f8260e02bf6290fe386337e4c66858eaf20340d /kernel/pid.c
parentfaf145d6f3f3d6f2c066f65602ba9d0a03106915 (diff)
parentf7cfd871ae0c5008d94b6f66834e7845caa93c15 (diff)
downloadlinux-d01e7f10dae29eba0f9ada82b65d24e035d5b2f9.tar.gz
Merge branch 'exec-update-lock-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace
Pull exec-update-lock update from Eric Biederman: "The key point of this is to transform exec_update_mutex into a rw_semaphore so readers can be separated from writers. This makes it easier to understand what the holders of the lock are doing, and makes it harder to contend or deadlock on the lock. The real deadlock fix wound up in perf_event_open" * 'exec-update-lock-for-v5.11' of git://git.kernel.org/pub/scm/linux/kernel/git/ebiederm/user-namespace: exec: Transform exec_update_mutex into a rw_semaphore
Diffstat (limited to 'kernel/pid.c')
-rw-r--r--kernel/pid.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/pid.c b/kernel/pid.c
index 47466d0bbc5b..ebdf9c60cd0b 100644
--- a/kernel/pid.c
+++ b/kernel/pid.c
@@ -628,7 +628,7 @@ static struct file *__pidfd_fget(struct task_struct *task, int fd)
struct file *file;
int ret;
- ret = mutex_lock_killable(&task->signal->exec_update_mutex);
+ ret = down_read_killable(&task->signal->exec_update_lock);
if (ret)
return ERR_PTR(ret);
@@ -637,7 +637,7 @@ static struct file *__pidfd_fget(struct task_struct *task, int fd)
else
file = ERR_PTR(-EPERM);
- mutex_unlock(&task->signal->exec_update_mutex);
+ up_read(&task->signal->exec_update_lock);
return file ?: ERR_PTR(-EBADF);
}