Skip to content

Commit

Permalink
proc: delete redundant subset=pid check
Browse files Browse the repository at this point in the history
Two checks in lookup and readdir code should be enough to not have third
check in open code.

Can't open what can't be looked up?

Link: https://lkml.kernel.org/r/YFYYwIBIkytqnkxP@localhost.localdomain
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Alexey Gladkov <gladkov.alexey@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Alexey Dobriyan authored and Linus Torvalds committed May 7, 2021
1 parent d4455fa commit 1dcdd7e
Showing 1 changed file with 0 additions and 4 deletions.
4 changes: 0 additions & 4 deletions fs/proc/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,6 @@ proc_reg_get_unmapped_area(struct file *file, unsigned long orig_addr,

static int proc_reg_open(struct inode *inode, struct file *file)
{
struct proc_fs_info *fs_info = proc_sb_info(inode->i_sb);
struct proc_dir_entry *pde = PDE(inode);
int rv = 0;
typeof_member(struct proc_ops, proc_open) open;
Expand All @@ -497,9 +496,6 @@ static int proc_reg_open(struct inode *inode, struct file *file)
return rv;
}

if (fs_info->pidonly == PROC_PIDONLY_ON)
return -ENOENT;

/*
* Ensure that
* 1) PDE's ->release hook will be called no matter what
Expand Down

0 comments on commit 1dcdd7e

Please sign in to comment.