Relax /proc fix a bit
authorLinus Torvalds <torvalds@g5.osdl.org>
Sat, 15 Jul 2006 04:48:03 +0000 (21:48 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 15 Jul 2006 04:48:03 +0000 (21:48 -0700)
Clearign all of i_mode was a bit draconian. We only really care about
S_ISUID/ISGID, after all.

Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/proc/base.c

index 0cb8f20d000c25118947fcafa81606300ced35f8..474eae345068337aad83b8b4f80d0e821cb67ed7 100644 (file)
@@ -1338,8 +1338,8 @@ static int pid_revalidate(struct dentry *dentry, struct nameidata *nd)
                } else {
                        inode->i_uid = 0;
                        inode->i_gid = 0;
-                       inode->i_mode = 0;
                }
+               inode->i_mode &= ~(S_ISUID | S_ISGID);
                security_task_to_inode(task, inode);
                put_task_struct(task);
                return 1;
@@ -1390,6 +1390,7 @@ static int tid_fd_revalidate(struct dentry *dentry, struct nameidata *nd)
                                        inode->i_uid = 0;
                                        inode->i_gid = 0;
                                }
+                               inode->i_mode &= ~(S_ISUID | S_ISGID);
                                security_task_to_inode(task, inode);
                                put_task_struct(task);
                                return 1;