Skip to contentSkip to conversation

proc: delete redundant subset=pid check

PATCH Applied Alexey Dobriyan 2 participants 2 messages Mar 20, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: delete redundant subset=pid check

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?

---

 fs/proc/inode.c |    4 ----
 1 file changed, 4 deletions(-)
fs/proc/inode.c +0 -4
@@ -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;
@@ -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
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Alexey Dobriyan

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?

As far as I remember, I first added pidonly processing here and later then I disabled lookup. Now this is unnecessary.

Quoted 27 lines

---

 fs/proc/inode.c |    4 ----
 1 file changed, 4 deletions(-)
fs/proc/inode.c +0 -4
@@ -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;
@@ -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
Signature · 1 line
Rgrds, legion