diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2012-01-21 15:35:23 -0500 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2012-01-24 19:37:55 -0500 |
commit | ec6a52668d0bbc6d648e978c327150254bf1ce7f (patch) | |
tree | d3241580b5f95515b9a1cedea588cea91d35f816 /fs/proc | |
parent | 6e9d5164153ad6539edd31e7afb02a3e79124cad (diff) |
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')
-rw-r--r-- | fs/proc/proc_sysctl.c | 9 |
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( | |||
1076 | struct nsproxy *namespaces, | 1076 | struct nsproxy *namespaces, |
1077 | const struct ctl_path *path, struct ctl_table *table) | 1077 | const struct ctl_path *path, struct ctl_table *table) |
1078 | { | 1078 | { |
1079 | struct ctl_table *ctl_table_arg = table; | ||
1079 | struct ctl_table_header *header = NULL; | 1080 | struct ctl_table_header *header = NULL; |
1080 | const struct ctl_path *component; | 1081 | const struct ctl_path *component; |
1081 | char *new_path, *pos; | 1082 | char *new_path, *pos; |
@@ -1090,7 +1091,15 @@ struct ctl_table_header *__register_sysctl_paths( | |||
1090 | if (!pos) | 1091 | if (!pos) |
1091 | goto out; | 1092 | goto out; |
1092 | } | 1093 | } |
1094 | while (table->procname && table->child && !table[1].procname) { | ||
1095 | pos = append_path(new_path, pos, table->procname); | ||
1096 | if (!pos) | ||
1097 | goto out; | ||
1098 | table = table->child; | ||
1099 | } | ||
1093 | header = __register_sysctl_table(root, namespaces, new_path, table); | 1100 | header = __register_sysctl_table(root, namespaces, new_path, table); |
1101 | if (header) | ||
1102 | header->ctl_table_arg = ctl_table_arg; | ||
1094 | out: | 1103 | out: |
1095 | kfree(new_path); | 1104 | kfree(new_path); |
1096 | return header; | 1105 | return header; |