proc: remove useless d_is_dir() check
authorChristian Brauner <christian@brauner.io>
Thu, 27 Jun 2019 09:35:14 +0000 (11:35 +0200)
committerChristian Brauner <christian@brauner.io>
Thu, 27 Jun 2019 10:25:09 +0000 (12:25 +0200)
Remove the d_is_dir() check from tgid_pidfd_to_pid().

It is pointless since you should never get &proc_tgid_base_operations
for f_op on a non-directory.

Suggested-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Christian Brauner <christian@brauner.io>
fs/proc/base.c

index 9c8ca6cd3ce42d19809f3104482ac01cee2b5ce1..255f6754c70d5800777434557898ca8b35721d1f 100644 (file)
@@ -3077,8 +3077,7 @@ static const struct file_operations proc_tgid_base_operations = {
 
 struct pid *tgid_pidfd_to_pid(const struct file *file)
 {
-       if (!d_is_dir(file->f_path.dentry) ||
-           (file->f_op != &proc_tgid_base_operations))
+       if (file->f_op != &proc_tgid_base_operations)
                return ERR_PTR(-EBADF);
 
        return proc_pid(file_inode(file));