lkml.org 
[lkml]   [2011]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH] sysctl: ctl_table->parent is only used for sysctl checks
Signed-off-by: Lucian Adrian Grijincu <lucian.grijincu@gmail.com>
---
include/linux/sysctl.h | 2 ++
kernel/sysctl.c | 7 +++++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h
index 7bb5cb6..026681f 100644
--- a/include/linux/sysctl.h
+++ b/include/linux/sysctl.h
@@ -1018,7 +1018,9 @@ struct ctl_table
int maxlen;
mode_t mode;
struct ctl_table *child;
+#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
struct ctl_table *parent; /* Automatically set */
+#endif
proc_handler *proc_handler; /* Callback for text formatting */
void *extra1;
void *extra2;
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index ae5cbb1..c5bade1 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1706,6 +1706,7 @@ int sysctl_perm(struct ctl_table_root *root, struct ctl_table *table, int op)
return test_perm(mode, op);
}

+#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
{
for (; table->procname; table++) {
@@ -1714,11 +1715,13 @@ static void sysctl_set_parent(struct ctl_table *parent, struct ctl_table *table)
sysctl_set_parent(table, table->child);
}
}
+#endif
+

static __init int sysctl_init(void)
{
- sysctl_set_parent(NULL, root_table);
#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
+ sysctl_set_parent(NULL, root_table);
sysctl_check_table(current->nsproxy, root_table);
#endif
return 0;
@@ -1875,9 +1878,9 @@ struct ctl_table_header *__register_sysctl_paths(
header->used = 0;
header->unregistering = NULL;
header->root = root;
- sysctl_set_parent(NULL, header->ctl_table);
header->count = 1;
#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
+ sysctl_set_parent(NULL, header->ctl_table);
if (sysctl_check_table(namespaces, header->ctl_table)) {
kfree(header);
return NULL;
\
 
 \ /
  Last update: 2011-01-12 11:19    [W:0.231 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site