diff options
Diffstat (limited to 'kernel/sysctl.c')
-rw-r--r-- | kernel/sysctl.c | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/kernel/sysctl.c b/kernel/sysctl.c index 8bff2c18fb5a..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) { |
@@ -2680,13 +2682,33 @@ int sysctl_ms_jiffies(ctl_table *table, int __user *name, int nlen, | |||
2680 | asmlinkage long sys_sysctl(struct __sysctl_args __user *args) | 2682 | asmlinkage long sys_sysctl(struct __sysctl_args __user *args) |
2681 | { | 2683 | { |
2682 | static int msg_count; | 2684 | static int msg_count; |
2685 | struct __sysctl_args tmp; | ||
2686 | int name[CTL_MAXNAME]; | ||
2687 | int i; | ||
2688 | |||
2689 | /* Read in the sysctl name for better debug message logging */ | ||
2690 | if (copy_from_user(&tmp, args, sizeof(tmp))) | ||
2691 | return -EFAULT; | ||
2692 | if (tmp.nlen <= 0 || tmp.nlen >= CTL_MAXNAME) | ||
2693 | return -ENOTDIR; | ||
2694 | for (i = 0; i < tmp.nlen; i++) | ||
2695 | if (get_user(name[i], tmp.name + i)) | ||
2696 | return -EFAULT; | ||
2697 | |||
2698 | /* Ignore accesses to kernel.version */ | ||
2699 | if ((tmp.nlen == 2) && (name[0] == CTL_KERN) && (name[1] == KERN_VERSION)) | ||
2700 | goto out; | ||
2683 | 2701 | ||
2684 | if (msg_count < 5) { | 2702 | if (msg_count < 5) { |
2685 | msg_count++; | 2703 | msg_count++; |
2686 | printk(KERN_INFO | 2704 | printk(KERN_INFO |
2687 | "warning: process `%s' used the removed sysctl " | 2705 | "warning: process `%s' used the removed sysctl " |
2688 | "system call\n", current->comm); | 2706 | "system call with ", current->comm); |
2707 | for (i = 0; i < tmp.nlen; i++) | ||
2708 | printk("%d.", name[i]); | ||
2709 | printk("\n"); | ||
2689 | } | 2710 | } |
2711 | out: | ||
2690 | return -ENOSYS; | 2712 | return -ENOSYS; |
2691 | } | 2713 | } |
2692 | 2714 | ||