mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 03:04:51 +01:00
pidfs: fix pidfs_free_pid()
Ensure that we handle the case where task creation fails and pid->attr was never accessed at all. Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
4e3d1e6e1b
commit
f077638b5f
1 changed files with 10 additions and 8 deletions
18
fs/pidfs.c
18
fs/pidfs.c
|
|
@ -150,18 +150,20 @@ void pidfs_free_pid(struct pid *pid)
|
|||
*/
|
||||
VFS_WARN_ON_ONCE(pid->stashed);
|
||||
|
||||
/*
|
||||
* This if an error occurred during e.g., task creation that
|
||||
* causes us to never go through the exit path.
|
||||
*/
|
||||
if (unlikely(!attr))
|
||||
return;
|
||||
|
||||
/* This never had a pidfd created. */
|
||||
if (IS_ERR(attr))
|
||||
return;
|
||||
|
||||
/*
|
||||
* Any dentry must've been wiped from the pid by now. Otherwise
|
||||
* there's a reference count bug.
|
||||
*/
|
||||
VFS_WARN_ON_ONCE(pid->stashed);
|
||||
|
||||
xattrs = attr->xattrs;
|
||||
xattrs = no_free_ptr(attr->xattrs);
|
||||
if (xattrs)
|
||||
simple_xattrs_free(attr->xattrs, NULL);
|
||||
simple_xattrs_free(xattrs, NULL);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PROC_FS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue