diff options
author | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:49:58 -0500 |
---|---|---|
committer | Nick Piggin <npiggin@kernel.dk> | 2011-01-07 01:50:29 -0500 |
commit | b74c79e99389cd79b31fcc08f82c24e492e63c7e (patch) | |
tree | 763c6b412517306670bc625e90035f2d16bb739f /fs/proc | |
parent | 34286d6662308d82aed891852d04c7c3a2649b16 (diff) |
fs: provide rcu-walk aware permission i_ops
Signed-off-by: Nick Piggin <npiggin@kernel.dk>
Diffstat (limited to 'fs/proc')
-rw-r--r-- | fs/proc/base.c | 6 | ||||
-rw-r--r-- | fs/proc/proc_sysctl.c | 5 |
2 files changed, 8 insertions, 3 deletions
diff --git a/fs/proc/base.c b/fs/proc/base.c index dc5b2fcadc3b..b953d41d9abf 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c | |||
@@ -2114,11 +2114,13 @@ static const struct file_operations proc_fd_operations = { | |||
2114 | * /proc/pid/fd needs a special permission handler so that a process can still | 2114 | * /proc/pid/fd needs a special permission handler so that a process can still |
2115 | * access /proc/self/fd after it has executed a setuid(). | 2115 | * access /proc/self/fd after it has executed a setuid(). |
2116 | */ | 2116 | */ |
2117 | static int proc_fd_permission(struct inode *inode, int mask) | 2117 | static int proc_fd_permission(struct inode *inode, int mask, unsigned int flags) |
2118 | { | 2118 | { |
2119 | int rv; | 2119 | int rv; |
2120 | 2120 | ||
2121 | rv = generic_permission(inode, mask, NULL); | 2121 | if (flags & IPERM_FLAG_RCU) |
2122 | return -ECHILD; | ||
2123 | rv = generic_permission(inode, mask, flags, NULL); | ||
2122 | if (rv == 0) | 2124 | if (rv == 0) |
2123 | return 0; | 2125 | return 0; |
2124 | if (task_pid(current) == proc_pid(inode)) | 2126 | if (task_pid(current) == proc_pid(inode)) |
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c index c9097f43b425..09a1f92a34ef 100644 --- a/fs/proc/proc_sysctl.c +++ b/fs/proc/proc_sysctl.c | |||
@@ -295,7 +295,7 @@ out: | |||
295 | return ret; | 295 | return ret; |
296 | } | 296 | } |
297 | 297 | ||
298 | static int proc_sys_permission(struct inode *inode, int mask) | 298 | static int proc_sys_permission(struct inode *inode, int mask,unsigned int flags) |
299 | { | 299 | { |
300 | /* | 300 | /* |
301 | * sysctl entries that are not writeable, | 301 | * sysctl entries that are not writeable, |
@@ -305,6 +305,9 @@ static int proc_sys_permission(struct inode *inode, int mask) | |||
305 | struct ctl_table *table; | 305 | struct ctl_table *table; |
306 | int error; | 306 | int error; |
307 | 307 | ||
308 | if (flags & IPERM_FLAG_RCU) | ||
309 | return -ECHILD; | ||
310 | |||
308 | /* Executable files are not allowed under /proc/sys/ */ | 311 | /* Executable files are not allowed under /proc/sys/ */ |
309 | if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode)) | 312 | if ((mask & MAY_EXEC) && S_ISREG(inode->i_mode)) |
310 | return -EACCES; | 313 | return -EACCES; |