aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2007-02-14 03:34:11 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-14 11:09:59 -0500
commit1ff007eb8e8c7c44e9a384a67d0fdd0fd06ba811 (patch)
tree01ed52bee21a39302ccfd49315a79806506177c7 /kernel
parent805b5d5e063e7fde5e2eb724e3f4cb18e47cab19 (diff)
[PATCH] sysctl: allow sysctl_perm to be called from outside of sysctl.c
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/sysctl.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c3e2ac9cb5fb..6bbac5ce75ed 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1157,7 +1157,7 @@ asmlinkage long sys_sysctl(struct __sysctl_args __user *args)
1157#endif /* CONFIG_SYSCTL_SYSCALL */ 1157#endif /* CONFIG_SYSCTL_SYSCALL */
1158 1158
1159/* 1159/*
1160 * ctl_perm does NOT grant the superuser all rights automatically, because 1160 * sysctl_perm does NOT grant the superuser all rights automatically, because
1161 * some sysctl variables are readonly even to root. 1161 * some sysctl variables are readonly even to root.
1162 */ 1162 */
1163 1163
@@ -1172,7 +1172,7 @@ static int test_perm(int mode, int op)
1172 return -EACCES; 1172 return -EACCES;
1173} 1173}
1174 1174
1175static inline int ctl_perm(ctl_table *table, int op) 1175int sysctl_perm(ctl_table *table, int op)
1176{ 1176{
1177 int error; 1177 int error;
1178 error = security_sysctl(table, op); 1178 error = security_sysctl(table, op);
@@ -1199,7 +1199,7 @@ repeat:
1199 if (n == table->ctl_name) { 1199 if (n == table->ctl_name) {
1200 int error; 1200 int error;
1201 if (table->child) { 1201 if (table->child) {
1202 if (ctl_perm(table, 001)) 1202 if (sysctl_perm(table, 001))
1203 return -EPERM; 1203 return -EPERM;
1204 name++; 1204 name++;
1205 nlen--; 1205 nlen--;
@@ -1228,7 +1228,7 @@ int do_sysctl_strategy (ctl_table *table,
1228 op |= 004; 1228 op |= 004;
1229 if (newval) 1229 if (newval)
1230 op |= 002; 1230 op |= 002;
1231 if (ctl_perm(table, op)) 1231 if (sysctl_perm(table, op))
1232 return -EPERM; 1232 return -EPERM;
1233 1233
1234 if (table->strategy) { 1234 if (table->strategy) {
@@ -1498,7 +1498,7 @@ static ssize_t do_rw_proc(int write, struct file * file, char __user * buf,
1498 goto out; 1498 goto out;
1499 error = -EPERM; 1499 error = -EPERM;
1500 op = (write ? 002 : 004); 1500 op = (write ? 002 : 004);
1501 if (ctl_perm(table, op)) 1501 if (sysctl_perm(table, op))
1502 goto out; 1502 goto out;
1503 1503
1504 /* careful: calling conventions are nasty here */ 1504 /* careful: calling conventions are nasty here */