diff options
| -rw-r--r-- | include/linux/sysctl.h | 9 | ||||
| -rw-r--r-- | kernel/sysctl.c | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/include/linux/sysctl.h b/include/linux/sysctl.h index 1b24bd45e080..c184732a70fc 100644 --- a/include/linux/sysctl.h +++ b/include/linux/sysctl.h | |||
| @@ -961,8 +961,8 @@ extern ctl_handler sysctl_ms_jiffies; | |||
| 961 | /* | 961 | /* |
| 962 | * Register a set of sysctl names by calling register_sysctl_table | 962 | * Register a set of sysctl names by calling register_sysctl_table |
| 963 | * with an initialised array of ctl_table's. An entry with zero | 963 | * with an initialised array of ctl_table's. An entry with zero |
| 964 | * ctl_name terminates the table. table->de will be set up by the | 964 | * ctl_name and NULL procname terminates the table. table->de will be |
| 965 | * registration and need not be initialised in advance. | 965 | * set up by the registration and need not be initialised in advance. |
| 966 | * | 966 | * |
| 967 | * sysctl names can be mirrored automatically under /proc/sys. The | 967 | * sysctl names can be mirrored automatically under /proc/sys. The |
| 968 | * procname supplied controls /proc naming. | 968 | * procname supplied controls /proc naming. |
| @@ -973,7 +973,10 @@ extern ctl_handler sysctl_ms_jiffies; | |||
| 973 | * Leaf nodes in the sysctl tree will be represented by a single file | 973 | * Leaf nodes in the sysctl tree will be represented by a single file |
| 974 | * under /proc; non-leaf nodes will be represented by directories. A | 974 | * under /proc; non-leaf nodes will be represented by directories. A |
| 975 | * null procname disables /proc mirroring at this node. | 975 | * null procname disables /proc mirroring at this node. |
| 976 | * | 976 | * |
| 977 | * sysctl entries with a zero ctl_name will not be available through | ||
| 978 | * the binary sysctl interface. | ||
| 979 | * | ||
| 977 | * sysctl(2) can automatically manage read and write requests through | 980 | * sysctl(2) can automatically manage read and write requests through |
| 978 | * the sysctl table. The data and maxlen fields of the ctl_table | 981 | * the sysctl table. The data and maxlen fields of the ctl_table |
| 979 | * struct enable minimal validation of the values being written to be | 982 | * struct enable minimal validation of the values being written to be |
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 0c8e805bbd6f..09e569f4792b 100644 --- a/kernel/sysctl.c +++ b/kernel/sysctl.c | |||
| @@ -1315,7 +1315,9 @@ repeat: | |||
| 1315 | return -ENOTDIR; | 1315 | return -ENOTDIR; |
| 1316 | if (get_user(n, name)) | 1316 | if (get_user(n, name)) |
| 1317 | return -EFAULT; | 1317 | return -EFAULT; |
| 1318 | for ( ; table->ctl_name; table++) { | 1318 | for ( ; table->ctl_name || table->procname; table++) { |
| 1319 | if (!table->ctl_name) | ||
| 1320 | continue; | ||
| 1319 | if (n == table->ctl_name || table->ctl_name == CTL_ANY) { | 1321 | if (n == table->ctl_name || table->ctl_name == CTL_ANY) { |
| 1320 | int error; | 1322 | int error; |
| 1321 | if (table->child) { | 1323 | if (table->child) { |
| @@ -1532,7 +1534,7 @@ static void register_proc_table(ctl_table * table, struct proc_dir_entry *root, | |||
| 1532 | int len; | 1534 | int len; |
| 1533 | mode_t mode; | 1535 | mode_t mode; |
| 1534 | 1536 | ||
| 1535 | for (; table->ctl_name; table++) { | 1537 | for (; table->ctl_name || table->procname; table++) { |
| 1536 | /* Can't do anything without a proc name. */ | 1538 | /* Can't do anything without a proc name. */ |
| 1537 | if (!table->procname) | 1539 | if (!table->procname) |
| 1538 | continue; | 1540 | continue; |
| @@ -1579,7 +1581,7 @@ static void register_proc_table(ctl_table * table, struct proc_dir_entry *root, | |||
| 1579 | static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root) | 1581 | static void unregister_proc_table(ctl_table * table, struct proc_dir_entry *root) |
| 1580 | { | 1582 | { |
| 1581 | struct proc_dir_entry *de; | 1583 | struct proc_dir_entry *de; |
| 1582 | for (; table->ctl_name; table++) { | 1584 | for (; table->ctl_name || table->procname; table++) { |
| 1583 | if (!(de = table->de)) | 1585 | if (!(de = table->de)) |
| 1584 | continue; | 1586 | continue; |
| 1585 | if (de->mode & S_IFDIR) { | 1587 | if (de->mode & S_IFDIR) { |
