diff options
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/cpu.c | 2 | ||||
-rw-r--r-- | kernel/delayacct.c | 15 | ||||
-rw-r--r-- | kernel/sysctl.c | 30 |
3 files changed, 36 insertions, 11 deletions
diff --git a/kernel/cpu.c b/kernel/cpu.c index 663c920b2234..272254f20d97 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c | |||
@@ -58,8 +58,8 @@ void unlock_cpu_hotplug(void) | |||
58 | recursive_depth--; | 58 | recursive_depth--; |
59 | return; | 59 | return; |
60 | } | 60 | } |
61 | mutex_unlock(&cpu_bitmask_lock); | ||
62 | recursive = NULL; | 61 | recursive = NULL; |
62 | mutex_unlock(&cpu_bitmask_lock); | ||
63 | } | 63 | } |
64 | EXPORT_SYMBOL_GPL(unlock_cpu_hotplug); | 64 | EXPORT_SYMBOL_GPL(unlock_cpu_hotplug); |
65 | 65 | ||
diff --git a/kernel/delayacct.c b/kernel/delayacct.c index 36752f124c6a..66a0ea48751d 100644 --- a/kernel/delayacct.c +++ b/kernel/delayacct.c | |||
@@ -66,6 +66,7 @@ static void delayacct_end(struct timespec *start, struct timespec *end, | |||
66 | { | 66 | { |
67 | struct timespec ts; | 67 | struct timespec ts; |
68 | s64 ns; | 68 | s64 ns; |
69 | unsigned long flags; | ||
69 | 70 | ||
70 | do_posix_clock_monotonic_gettime(end); | 71 | do_posix_clock_monotonic_gettime(end); |
71 | ts = timespec_sub(*end, *start); | 72 | ts = timespec_sub(*end, *start); |
@@ -73,10 +74,10 @@ static void delayacct_end(struct timespec *start, struct timespec *end, | |||
73 | if (ns < 0) | 74 | if (ns < 0) |
74 | return; | 75 | return; |
75 | 76 | ||
76 | spin_lock(¤t->delays->lock); | 77 | spin_lock_irqsave(¤t->delays->lock, flags); |
77 | *total += ns; | 78 | *total += ns; |
78 | (*count)++; | 79 | (*count)++; |
79 | spin_unlock(¤t->delays->lock); | 80 | spin_unlock_irqrestore(¤t->delays->lock, flags); |
80 | } | 81 | } |
81 | 82 | ||
82 | void __delayacct_blkio_start(void) | 83 | void __delayacct_blkio_start(void) |
@@ -104,6 +105,7 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk) | |||
104 | s64 tmp; | 105 | s64 tmp; |
105 | struct timespec ts; | 106 | struct timespec ts; |
106 | unsigned long t1,t2,t3; | 107 | unsigned long t1,t2,t3; |
108 | unsigned long flags; | ||
107 | 109 | ||
108 | /* Though tsk->delays accessed later, early exit avoids | 110 | /* Though tsk->delays accessed later, early exit avoids |
109 | * unnecessary returning of other data | 111 | * unnecessary returning of other data |
@@ -136,14 +138,14 @@ int __delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk) | |||
136 | 138 | ||
137 | /* zero XXX_total, non-zero XXX_count implies XXX stat overflowed */ | 139 | /* zero XXX_total, non-zero XXX_count implies XXX stat overflowed */ |
138 | 140 | ||
139 | spin_lock(&tsk->delays->lock); | 141 | spin_lock_irqsave(&tsk->delays->lock, flags); |
140 | tmp = d->blkio_delay_total + tsk->delays->blkio_delay; | 142 | tmp = d->blkio_delay_total + tsk->delays->blkio_delay; |
141 | d->blkio_delay_total = (tmp < d->blkio_delay_total) ? 0 : tmp; | 143 | d->blkio_delay_total = (tmp < d->blkio_delay_total) ? 0 : tmp; |
142 | tmp = d->swapin_delay_total + tsk->delays->swapin_delay; | 144 | tmp = d->swapin_delay_total + tsk->delays->swapin_delay; |
143 | d->swapin_delay_total = (tmp < d->swapin_delay_total) ? 0 : tmp; | 145 | d->swapin_delay_total = (tmp < d->swapin_delay_total) ? 0 : tmp; |
144 | d->blkio_count += tsk->delays->blkio_count; | 146 | d->blkio_count += tsk->delays->blkio_count; |
145 | d->swapin_count += tsk->delays->swapin_count; | 147 | d->swapin_count += tsk->delays->swapin_count; |
146 | spin_unlock(&tsk->delays->lock); | 148 | spin_unlock_irqrestore(&tsk->delays->lock, flags); |
147 | 149 | ||
148 | done: | 150 | done: |
149 | return 0; | 151 | return 0; |
@@ -152,11 +154,12 @@ done: | |||
152 | __u64 __delayacct_blkio_ticks(struct task_struct *tsk) | 154 | __u64 __delayacct_blkio_ticks(struct task_struct *tsk) |
153 | { | 155 | { |
154 | __u64 ret; | 156 | __u64 ret; |
157 | unsigned long flags; | ||
155 | 158 | ||
156 | spin_lock(&tsk->delays->lock); | 159 | spin_lock_irqsave(&tsk->delays->lock, flags); |
157 | ret = nsec_to_clock_t(tsk->delays->blkio_delay + | 160 | ret = nsec_to_clock_t(tsk->delays->blkio_delay + |
158 | tsk->delays->swapin_delay); | 161 | tsk->delays->swapin_delay); |
159 | spin_unlock(&tsk->delays->lock); | 162 | spin_unlock_irqrestore(&tsk->delays->lock, flags); |
160 | return ret; | 163 | return ret; |
161 | } | 164 | } |
162 | 165 | ||
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 | ||