summaryrefslogtreecommitdiffstats
path: root/fs/proc/proc_sysctl.c
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2012-01-21 12:35:23 -0800
committerEric W. Biederman <ebiederm@xmission.com>2012-01-24 16:37:55 -0800
commitec6a52668d0bbc6d648e978c327150254bf1ce7f (patch)
treed3241580b5f95515b9a1cedea588cea91d35f816 /fs/proc/proc_sysctl.c
parent6e9d5164153ad6539edd31e7afb02a3e79124cad (diff)
downloadlinux-ec6a52668d0bbc6d648e978c327150254bf1ce7f.tar.bz2
sysctl: Add ctl_table chains into cstring paths
For any component of table passed to __register_sysctl_paths that actually serves as a path, add that to the cstring path that is passed to __register_sysctl_table. The result is that for most calls to __register_sysctl_paths we only pass a table to __register_sysctl_table that contains no child directories. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'fs/proc/proc_sysctl.c')
-rw-r--r--fs/proc/proc_sysctl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c
index 5704ff0e889f..9b91deeeb56c 100644
--- a/fs/proc/proc_sysctl.c
+++ b/fs/proc/proc_sysctl.c
@@ -1076,6 +1076,7 @@ struct ctl_table_header *__register_sysctl_paths(
struct nsproxy *namespaces,
const struct ctl_path *path, struct ctl_table *table)
{
+ struct ctl_table *ctl_table_arg = table;
struct ctl_table_header *header = NULL;
const struct ctl_path *component;
char *new_path, *pos;
@@ -1090,7 +1091,15 @@ struct ctl_table_header *__register_sysctl_paths(
if (!pos)
goto out;
}
+ while (table->procname && table->child && !table[1].procname) {
+ pos = append_path(new_path, pos, table->procname);
+ if (!pos)
+ goto out;
+ table = table->child;
+ }
header = __register_sysctl_table(root, namespaces, new_path, table);
+ if (header)
+ header->ctl_table_arg = ctl_table_arg;
out:
kfree(new_path);
return header;