diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2020-04-24 22:41:20 +0200 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2020-04-24 22:49:00 +0200 |
commit | 6ade99ec6175ab2b54c227521e181e1c3c2bfc8a (patch) | |
tree | bcbb3ed8d7cb60920556673bd571a8206c21e759 /fs/proc/base.c | |
parent | signal: Avoid corrupting si_pid and si_uid in do_notify_parent (diff) | |
download | linux-6ade99ec6175ab2b54c227521e181e1c3c2bfc8a.tar.xz linux-6ade99ec6175ab2b54c227521e181e1c3c2bfc8a.zip |
proc: Put thread_pid in release_task not proc_flush_pid
Oleg pointed out that in the unlikely event the kernel is compiled
with CONFIG_PROC_FS unset that release_task will now leak the pid.
Move the put_pid out of proc_flush_pid into release_task to fix this
and to guarantee I don't make that mistake again.
When possible it makes sense to keep get and put in the same function
so it can easily been seen how they pair up.
Fixes: 7bc3e6e55acf ("proc: Use a list of inodes to flush from proc")
Reported-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc/base.c')
-rw-r--r-- | fs/proc/base.c | 1 |
1 files changed, 0 insertions, 1 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index 6042b646ab27..42f43c7b9669 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -3274,7 +3274,6 @@ static const struct inode_operations proc_tgid_base_inode_operations = { void proc_flush_pid(struct pid *pid) { proc_invalidate_siblings_dcache(&pid->inodes, &pid->lock); - put_pid(pid); } static struct dentry *proc_pid_instantiate(struct dentry * dentry, |