Allow to catch some obvious bugs. Signed-off-by: Christian Brauner <brauner@xxxxxxxxxx> --- fs/pidfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/pidfs.c b/fs/pidfs.c index 15d99854d243..1cf66fd9961e 100644 --- a/fs/pidfs.c +++ b/fs/pidfs.c @@ -809,6 +809,8 @@ static struct dentry *pidfs_fh_to_dentry(struct super_block *sb, if (ret < 0) return ERR_PTR(ret); + VFS_WARN_ON_ONCE(!pid->attr); + mntput(path.mnt); return path.dentry; } @@ -1038,6 +1040,8 @@ struct file *pidfs_alloc_file(struct pid *pid, unsigned int flags) if (ret < 0) return ERR_PTR(ret); + VFS_WARN_ON_ONCE(!pid->attr); + flags &= ~PIDFD_STALE; flags |= O_RDWR; pidfd_file = dentry_open(&path, flags, current_cred()); -- 2.47.2