aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/audit.c3
-rw-r--r--kernel/cpuset.c2
-rw-r--r--kernel/futex.c15
-rw-r--r--kernel/futex_compat.c12
-rw-r--r--kernel/irq/proc.c2
-rw-r--r--kernel/irq/resend.c2
-rw-r--r--kernel/lockdep.c5
-rw-r--r--kernel/module.c94
-rw-r--r--kernel/power/disk.c8
-rw-r--r--kernel/power/user.c10
-rw-r--r--kernel/printk.c11
-rw-r--r--kernel/profile.c2
-rw-r--r--kernel/relay.c41
-rw-r--r--kernel/sched.c6
-rw-r--r--kernel/workqueue.c7
15 files changed, 120 insertions, 100 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index f9889ee778..98106f6078 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -340,7 +340,7 @@ static int kauditd_thread(void *dummy)
340{ 340{
341 struct sk_buff *skb; 341 struct sk_buff *skb;
342 342
343 while (1) { 343 while (!kthread_should_stop()) {
344 skb = skb_dequeue(&audit_skb_queue); 344 skb = skb_dequeue(&audit_skb_queue);
345 wake_up(&audit_backlog_wait); 345 wake_up(&audit_backlog_wait);
346 if (skb) { 346 if (skb) {
@@ -369,6 +369,7 @@ static int kauditd_thread(void *dummy)
369 remove_wait_queue(&kauditd_wait, &wait); 369 remove_wait_queue(&kauditd_wait, &wait);
370 } 370 }
371 } 371 }
372 return 0;
372} 373}
373 374
374int audit_send_list(void *_dest) 375int audit_send_list(void *_dest)
diff --git a/kernel/cpuset.c b/kernel/cpuset.c
index 9d850ae13b..6313c38c93 100644
--- a/kernel/cpuset.c
+++ b/kernel/cpuset.c
@@ -2137,7 +2137,7 @@ static int cpuset_handle_cpuhp(struct notifier_block *nb,
2137 * See also the previous routine cpuset_handle_cpuhp(). 2137 * See also the previous routine cpuset_handle_cpuhp().
2138 */ 2138 */
2139 2139
2140void cpuset_track_online_nodes() 2140void cpuset_track_online_nodes(void)
2141{ 2141{
2142 common_cpu_mem_hotplug_unplug(); 2142 common_cpu_mem_hotplug_unplug();
2143} 2143}
diff --git a/kernel/futex.c b/kernel/futex.c
index 4aaf91951a..b364e00261 100644
--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1612,10 +1612,10 @@ sys_set_robust_list(struct robust_list_head __user *head,
1612 * @len_ptr: pointer to a length field, the kernel fills in the header size 1612 * @len_ptr: pointer to a length field, the kernel fills in the header size
1613 */ 1613 */
1614asmlinkage long 1614asmlinkage long
1615sys_get_robust_list(int pid, struct robust_list_head __user **head_ptr, 1615sys_get_robust_list(int pid, struct robust_list_head __user * __user *head_ptr,
1616 size_t __user *len_ptr) 1616 size_t __user *len_ptr)
1617{ 1617{
1618 struct robust_list_head *head; 1618 struct robust_list_head __user *head;
1619 unsigned long ret; 1619 unsigned long ret;
1620 1620
1621 if (!pid) 1621 if (!pid)
@@ -1694,14 +1694,15 @@ retry:
1694 * Fetch a robust-list pointer. Bit 0 signals PI futexes: 1694 * Fetch a robust-list pointer. Bit 0 signals PI futexes:
1695 */ 1695 */
1696static inline int fetch_robust_entry(struct robust_list __user **entry, 1696static inline int fetch_robust_entry(struct robust_list __user **entry,
1697 struct robust_list __user **head, int *pi) 1697 struct robust_list __user * __user *head,
1698 int *pi)
1698{ 1699{
1699 unsigned long uentry; 1700 unsigned long uentry;
1700 1701
1701 if (get_user(uentry, (unsigned long *)head)) 1702 if (get_user(uentry, (unsigned long __user *)head))
1702 return -EFAULT; 1703 return -EFAULT;
1703 1704
1704 *entry = (void *)(uentry & ~1UL); 1705 *entry = (void __user *)(uentry & ~1UL);
1705 *pi = uentry & 1; 1706 *pi = uentry & 1;
1706 1707
1707 return 0; 1708 return 0;
@@ -1739,7 +1740,7 @@ void exit_robust_list(struct task_struct *curr)
1739 return; 1740 return;
1740 1741
1741 if (pending) 1742 if (pending)
1742 handle_futex_death((void *)pending + futex_offset, curr, pip); 1743 handle_futex_death((void __user *)pending + futex_offset, curr, pip);
1743 1744
1744 while (entry != &head->list) { 1745 while (entry != &head->list) {
1745 /* 1746 /*
@@ -1747,7 +1748,7 @@ void exit_robust_list(struct task_struct *curr)
1747 * don't process it twice: 1748 * don't process it twice:
1748 */ 1749 */
1749 if (entry != pending) 1750 if (entry != pending)
1750 if (handle_futex_death((void *)entry + futex_offset, 1751 if (handle_futex_death((void __user *)entry + futex_offset,
1751 curr, pi)) 1752 curr, pi))
1752 return; 1753 return;
1753 /* 1754 /*
diff --git a/kernel/futex_compat.c b/kernel/futex_compat.c
index c5cca3f65c..50f24eea6c 100644
--- a/kernel/futex_compat.c
+++ b/kernel/futex_compat.c
@@ -18,7 +18,7 @@
18 */ 18 */
19static inline int 19static inline int
20fetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry, 20fetch_robust_entry(compat_uptr_t *uentry, struct robust_list __user **entry,
21 compat_uptr_t *head, int *pi) 21 compat_uptr_t __user *head, int *pi)
22{ 22{
23 if (get_user(*uentry, head)) 23 if (get_user(*uentry, head))
24 return -EFAULT; 24 return -EFAULT;
@@ -62,7 +62,7 @@ void compat_exit_robust_list(struct task_struct *curr)
62 &head->list_op_pending, &pip)) 62 &head->list_op_pending, &pip))
63 return; 63 return;
64 if (upending) 64 if (upending)
65 handle_futex_death((void *)pending + futex_offset, curr, pip); 65 handle_futex_death((void __user *)pending + futex_offset, curr, pip);
66 66
67 while (compat_ptr(uentry) != &head->list) { 67 while (compat_ptr(uentry) != &head->list) {
68 /* 68 /*
@@ -70,7 +70,7 @@ void compat_exit_robust_list(struct task_struct *curr)
70 * dont process it twice: 70 * dont process it twice:
71 */ 71 */
72 if (entry != pending) 72 if (entry != pending)
73 if (handle_futex_death((void *)entry + futex_offset, 73 if (handle_futex_death((void __user *)entry + futex_offset,
74 curr, pi)) 74 curr, pi))
75 return; 75 return;
76 76
@@ -78,7 +78,7 @@ void compat_exit_robust_list(struct task_struct *curr)
78 * Fetch the next entry in the list: 78 * Fetch the next entry in the list:
79 */ 79 */
80 if (fetch_robust_entry(&uentry, &entry, 80 if (fetch_robust_entry(&uentry, &entry,
81 (compat_uptr_t *)&entry->next, &pi)) 81 (compat_uptr_t __user *)&entry->next, &pi))
82 return; 82 return;
83 /* 83 /*
84 * Avoid excessively long or circular lists: 84 * Avoid excessively long or circular lists:
@@ -103,10 +103,10 @@ compat_sys_set_robust_list(struct compat_robust_list_head __user *head,
103} 103}
104 104
105asmlinkage long 105asmlinkage long
106compat_sys_get_robust_list(int pid, compat_uptr_t *head_ptr, 106compat_sys_get_robust_list(int pid, compat_uptr_t __user *head_ptr,
107 compat_size_t __user *len_ptr) 107 compat_size_t __user *len_ptr)
108{ 108{
109 struct compat_robust_list_head *head; 109 struct compat_robust_list_head __user *head;
110 unsigned long ret; 110 unsigned long ret;
111 111
112 if (!pid) 112 if (!pid)
diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 607c7809ad..9a35266700 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -57,7 +57,7 @@ static int irq_affinity_write_proc(struct file *file, const char __user *buffer,
57 if (!irq_desc[irq].chip->set_affinity || no_irq_affinity) 57 if (!irq_desc[irq].chip->set_affinity || no_irq_affinity)
58 return -EIO; 58 return -EIO;
59 59
60 err = cpumask_parse(buffer, count, new_value); 60 err = cpumask_parse_user(buffer, count, new_value);
61 if (err) 61 if (err)
62 return err; 62 return err;
63 63
diff --git a/kernel/irq/resend.c b/kernel/irq/resend.c
index 35f10f7ff9..5bfeaed7e4 100644
--- a/kernel/irq/resend.c
+++ b/kernel/irq/resend.c
@@ -38,7 +38,7 @@ static void resend_irqs(unsigned long arg)
38 clear_bit(irq, irqs_resend); 38 clear_bit(irq, irqs_resend);
39 desc = irq_desc + irq; 39 desc = irq_desc + irq;
40 local_irq_disable(); 40 local_irq_disable();
41 desc->handle_irq(irq, desc, NULL); 41 desc->handle_irq(irq, desc);
42 local_irq_enable(); 42 local_irq_enable();
43 } 43 }
44} 44}
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 4c05534610..805a322a56 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -1114,8 +1114,6 @@ static int count_matching_names(struct lock_class *new_class)
1114 return count + 1; 1114 return count + 1;
1115} 1115}
1116 1116
1117extern void __error_too_big_MAX_LOCKDEP_SUBCLASSES(void);
1118
1119/* 1117/*
1120 * Register a lock's class in the hash-table, if the class is not present 1118 * Register a lock's class in the hash-table, if the class is not present
1121 * yet. Otherwise we look it up. We cache the result in the lock object 1119 * yet. Otherwise we look it up. We cache the result in the lock object
@@ -1153,8 +1151,7 @@ look_up_lock_class(struct lockdep_map *lock, unsigned int subclass)
1153 * (or spin_lock_init()) call - which acts as the key. For static 1151 * (or spin_lock_init()) call - which acts as the key. For static
1154 * locks we use the lock object itself as the key. 1152 * locks we use the lock object itself as the key.
1155 */ 1153 */
1156 if (sizeof(struct lock_class_key) > sizeof(struct lock_class)) 1154 BUILD_BUG_ON(sizeof(struct lock_class_key) > sizeof(struct lock_class));
1157 __error_too_big_MAX_LOCKDEP_SUBCLASSES();
1158 1155
1159 key = lock->key->subkeys + subclass; 1156 key = lock->key->subkeys + subclass;
1160 1157
diff --git a/kernel/module.c b/kernel/module.c
index 7f60e782de..67009bd56c 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -87,6 +87,12 @@ static inline int strong_try_module_get(struct module *mod)
87 return try_module_get(mod); 87 return try_module_get(mod);
88} 88}
89 89
90static inline void add_taint_module(struct module *mod, unsigned flag)
91{
92 add_taint(flag);
93 mod->taints |= flag;
94}
95
90/* A thread that wants to hold a reference to a module only while it 96/* A thread that wants to hold a reference to a module only while it
91 * is running can call ths to safely exit. 97 * is running can call ths to safely exit.
92 * nfsd and lockd use this. 98 * nfsd and lockd use this.
@@ -847,12 +853,10 @@ static int check_version(Elf_Shdr *sechdrs,
847 return 0; 853 return 0;
848 } 854 }
849 /* Not in module's version table. OK, but that taints the kernel. */ 855 /* Not in module's version table. OK, but that taints the kernel. */
850 if (!(tainted & TAINT_FORCED_MODULE)) { 856 if (!(tainted & TAINT_FORCED_MODULE))
851 printk("%s: no version for \"%s\" found: kernel tainted.\n", 857 printk("%s: no version for \"%s\" found: kernel tainted.\n",
852 mod->name, symname); 858 mod->name, symname);
853 add_taint(TAINT_FORCED_MODULE); 859 add_taint_module(mod, TAINT_FORCED_MODULE);
854 mod->taints |= TAINT_FORCED_MODULE;
855 }
856 return 1; 860 return 1;
857} 861}
858 862
@@ -910,7 +914,8 @@ static unsigned long resolve_symbol(Elf_Shdr *sechdrs,
910 unsigned long ret; 914 unsigned long ret;
911 const unsigned long *crc; 915 const unsigned long *crc;
912 916
913 ret = __find_symbol(name, &owner, &crc, mod->license_gplok); 917 ret = __find_symbol(name, &owner, &crc,
918 !(mod->taints & TAINT_PROPRIETARY_MODULE));
914 if (ret) { 919 if (ret) {
915 /* use_module can fail due to OOM, or module unloading */ 920 /* use_module can fail due to OOM, or module unloading */
916 if (!check_version(sechdrs, versindex, name, mod, crc) || 921 if (!check_version(sechdrs, versindex, name, mod, crc) ||
@@ -1335,12 +1340,11 @@ static void set_license(struct module *mod, const char *license)
1335 if (!license) 1340 if (!license)
1336 license = "unspecified"; 1341 license = "unspecified";
1337 1342
1338 mod->license_gplok = license_is_gpl_compatible(license); 1343 if (!license_is_gpl_compatible(license)) {
1339 if (!mod->license_gplok && !(tainted & TAINT_PROPRIETARY_MODULE)) { 1344 if (!(tainted & TAINT_PROPRIETARY_MODULE))
1340 printk(KERN_WARNING "%s: module license '%s' taints kernel.\n", 1345 printk(KERN_WARNING "%s: module license '%s' taints"
1341 mod->name, license); 1346 "kernel.\n", mod->name, license);
1342 add_taint(TAINT_PROPRIETARY_MODULE); 1347 add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
1343 mod->taints |= TAINT_PROPRIETARY_MODULE;
1344 } 1348 }
1345} 1349}
1346 1350
@@ -1619,8 +1623,7 @@ static struct module *load_module(void __user *umod,
1619 modmagic = get_modinfo(sechdrs, infoindex, "vermagic"); 1623 modmagic = get_modinfo(sechdrs, infoindex, "vermagic");
1620 /* This is allowed: modprobe --force will invalidate it. */ 1624 /* This is allowed: modprobe --force will invalidate it. */
1621 if (!modmagic) { 1625 if (!modmagic) {
1622 add_taint(TAINT_FORCED_MODULE); 1626 add_taint_module(mod, TAINT_FORCED_MODULE);
1623 mod->taints |= TAINT_FORCED_MODULE;
1624 printk(KERN_WARNING "%s: no version magic, tainting kernel.\n", 1627 printk(KERN_WARNING "%s: no version magic, tainting kernel.\n",
1625 mod->name); 1628 mod->name);
1626 } else if (!same_magic(modmagic, vermagic)) { 1629 } else if (!same_magic(modmagic, vermagic)) {
@@ -1714,14 +1717,10 @@ static struct module *load_module(void __user *umod,
1714 /* Set up license info based on the info section */ 1717 /* Set up license info based on the info section */
1715 set_license(mod, get_modinfo(sechdrs, infoindex, "license")); 1718 set_license(mod, get_modinfo(sechdrs, infoindex, "license"));
1716 1719
1717 if (strcmp(mod->name, "ndiswrapper") == 0) { 1720 if (strcmp(mod->name, "ndiswrapper") == 0)
1718 add_taint(TAINT_PROPRIETARY_MODULE); 1721 add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
1719 mod->taints |= TAINT_PROPRIETARY_MODULE; 1722 if (strcmp(mod->name, "driverloader") == 0)
1720 } 1723 add_taint_module(mod, TAINT_PROPRIETARY_MODULE);
1721 if (strcmp(mod->name, "driverloader") == 0) {
1722 add_taint(TAINT_PROPRIETARY_MODULE);
1723 mod->taints |= TAINT_PROPRIETARY_MODULE;
1724 }
1725 1724
1726 /* Set up MODINFO_ATTR fields */ 1725 /* Set up MODINFO_ATTR fields */
1727 setup_modinfo(mod, sechdrs, infoindex); 1726 setup_modinfo(mod, sechdrs, infoindex);
@@ -1766,8 +1765,7 @@ static struct module *load_module(void __user *umod,
1766 (mod->num_unused_gpl_syms && !unusedgplcrcindex)) { 1765 (mod->num_unused_gpl_syms && !unusedgplcrcindex)) {
1767 printk(KERN_WARNING "%s: No versions for exported symbols." 1766 printk(KERN_WARNING "%s: No versions for exported symbols."
1768 " Tainting kernel.\n", mod->name); 1767 " Tainting kernel.\n", mod->name);
1769 add_taint(TAINT_FORCED_MODULE); 1768 add_taint_module(mod, TAINT_FORCED_MODULE);
1770 mod->taints |= TAINT_FORCED_MODULE;
1771 } 1769 }
1772#endif 1770#endif
1773 1771
@@ -2132,9 +2130,33 @@ static void m_stop(struct seq_file *m, void *p)
2132 mutex_unlock(&module_mutex); 2130 mutex_unlock(&module_mutex);
2133} 2131}
2134 2132
2133static char *taint_flags(unsigned int taints, char *buf)
2134{
2135 int bx = 0;
2136
2137 if (taints) {
2138 buf[bx++] = '(';
2139 if (taints & TAINT_PROPRIETARY_MODULE)
2140 buf[bx++] = 'P';
2141 if (taints & TAINT_FORCED_MODULE)
2142 buf[bx++] = 'F';
2143 /*
2144 * TAINT_FORCED_RMMOD: could be added.
2145 * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't
2146 * apply to modules.
2147 */
2148 buf[bx++] = ')';
2149 }
2150 buf[bx] = '\0';
2151
2152 return buf;
2153}
2154
2135static int m_show(struct seq_file *m, void *p) 2155static int m_show(struct seq_file *m, void *p)
2136{ 2156{
2137 struct module *mod = list_entry(p, struct module, list); 2157 struct module *mod = list_entry(p, struct module, list);
2158 char buf[8];
2159
2138 seq_printf(m, "%s %lu", 2160 seq_printf(m, "%s %lu",
2139 mod->name, mod->init_size + mod->core_size); 2161 mod->name, mod->init_size + mod->core_size);
2140 print_unload_info(m, mod); 2162 print_unload_info(m, mod);
@@ -2147,6 +2169,10 @@ static int m_show(struct seq_file *m, void *p)
2147 /* Used by oprofile and other similar tools. */ 2169 /* Used by oprofile and other similar tools. */
2148 seq_printf(m, " 0x%p", mod->module_core); 2170 seq_printf(m, " 0x%p", mod->module_core);
2149 2171
2172 /* Taints info */
2173 if (mod->taints)
2174 seq_printf(m, " %s", taint_flags(mod->taints, buf));
2175
2150 seq_printf(m, "\n"); 2176 seq_printf(m, "\n");
2151 return 0; 2177 return 0;
2152} 2178}
@@ -2235,28 +2261,6 @@ struct module *module_text_address(unsigned long addr)
2235 return mod; 2261 return mod;
2236} 2262}
2237 2263
2238static char *taint_flags(unsigned int taints, char *buf)
2239{
2240 *buf = '\0';
2241 if (taints) {
2242 int bx;
2243
2244 buf[0] = '(';
2245 bx = 1;
2246 if (taints & TAINT_PROPRIETARY_MODULE)
2247 buf[bx++] = 'P';
2248 if (taints & TAINT_FORCED_MODULE)
2249 buf[bx++] = 'F';
2250 /*
2251 * TAINT_FORCED_RMMOD: could be added.
2252 * TAINT_UNSAFE_SMP, TAINT_MACHINE_CHECK, TAINT_BAD_PAGE don't
2253 * apply to modules.
2254 */
2255 buf[bx] = ')';
2256 }
2257 return buf;
2258}
2259
2260/* Don't grab lock, we're oopsing. */ 2264/* Don't grab lock, we're oopsing. */
2261void print_modules(void) 2265void print_modules(void)
2262{ 2266{
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index d722349427..d3a158a603 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -18,6 +18,7 @@
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/mount.h> 19#include <linux/mount.h>
20#include <linux/pm.h> 20#include <linux/pm.h>
21#include <linux/console.h>
21#include <linux/cpu.h> 22#include <linux/cpu.h>
22 23
23#include "power.h" 24#include "power.h"
@@ -119,8 +120,10 @@ int pm_suspend_disk(void)
119 if (error) 120 if (error)
120 return error; 121 return error;
121 122
123 suspend_console();
122 error = device_suspend(PMSG_FREEZE); 124 error = device_suspend(PMSG_FREEZE);
123 if (error) { 125 if (error) {
126 resume_console();
124 printk("Some devices failed to suspend\n"); 127 printk("Some devices failed to suspend\n");
125 unprepare_processes(); 128 unprepare_processes();
126 return error; 129 return error;
@@ -133,6 +136,7 @@ int pm_suspend_disk(void)
133 136
134 if (in_suspend) { 137 if (in_suspend) {
135 device_resume(); 138 device_resume();
139 resume_console();
136 pr_debug("PM: writing image.\n"); 140 pr_debug("PM: writing image.\n");
137 error = swsusp_write(); 141 error = swsusp_write();
138 if (!error) 142 if (!error)
@@ -148,6 +152,7 @@ int pm_suspend_disk(void)
148 swsusp_free(); 152 swsusp_free();
149 Done: 153 Done:
150 device_resume(); 154 device_resume();
155 resume_console();
151 unprepare_processes(); 156 unprepare_processes();
152 return error; 157 return error;
153} 158}
@@ -212,7 +217,9 @@ static int software_resume(void)
212 217
213 pr_debug("PM: Preparing devices for restore.\n"); 218 pr_debug("PM: Preparing devices for restore.\n");
214 219
220 suspend_console();
215 if ((error = device_suspend(PMSG_PRETHAW))) { 221 if ((error = device_suspend(PMSG_PRETHAW))) {
222 resume_console();
216 printk("Some devices failed to suspend\n"); 223 printk("Some devices failed to suspend\n");
217 swsusp_free(); 224 swsusp_free();
218 goto Thaw; 225 goto Thaw;
@@ -224,6 +231,7 @@ static int software_resume(void)
224 swsusp_resume(); 231 swsusp_resume();
225 pr_debug("PM: Restore failed, recovering.n"); 232 pr_debug("PM: Restore failed, recovering.n");
226 device_resume(); 233 device_resume();
234 resume_console();
227 Thaw: 235 Thaw:
228 unprepare_processes(); 236 unprepare_processes();
229 Done: 237 Done:
diff --git a/kernel/power/user.c b/kernel/power/user.c
index 72825c853c..d991d3b0e5 100644
--- a/kernel/power/user.c
+++ b/kernel/power/user.c
@@ -19,6 +19,7 @@
19#include <linux/swapops.h> 19#include <linux/swapops.h>
20#include <linux/pm.h> 20#include <linux/pm.h>
21#include <linux/fs.h> 21#include <linux/fs.h>
22#include <linux/console.h>
22#include <linux/cpu.h> 23#include <linux/cpu.h>
23 24
24#include <asm/uaccess.h> 25#include <asm/uaccess.h>
@@ -145,10 +146,10 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
145 error = freeze_processes(); 146 error = freeze_processes();
146 if (error) { 147 if (error) {
147 thaw_processes(); 148 thaw_processes();
149 enable_nonboot_cpus();
148 error = -EBUSY; 150 error = -EBUSY;
149 } 151 }
150 } 152 }
151 enable_nonboot_cpus();
152 up(&pm_sem); 153 up(&pm_sem);
153 if (!error) 154 if (!error)
154 data->frozen = 1; 155 data->frozen = 1;
@@ -173,12 +174,14 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
173 /* Free memory before shutting down devices. */ 174 /* Free memory before shutting down devices. */
174 error = swsusp_shrink_memory(); 175 error = swsusp_shrink_memory();
175 if (!error) { 176 if (!error) {
177 suspend_console();
176 error = device_suspend(PMSG_FREEZE); 178 error = device_suspend(PMSG_FREEZE);
177 if (!error) { 179 if (!error) {
178 in_suspend = 1; 180 in_suspend = 1;
179 error = swsusp_suspend(); 181 error = swsusp_suspend();
180 device_resume(); 182 device_resume();
181 } 183 }
184 resume_console();
182 } 185 }
183 up(&pm_sem); 186 up(&pm_sem);
184 if (!error) 187 if (!error)
@@ -196,11 +199,13 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
196 snapshot_free_unused_memory(&data->handle); 199 snapshot_free_unused_memory(&data->handle);
197 down(&pm_sem); 200 down(&pm_sem);
198 pm_prepare_console(); 201 pm_prepare_console();
202 suspend_console();
199 error = device_suspend(PMSG_PRETHAW); 203 error = device_suspend(PMSG_PRETHAW);
200 if (!error) { 204 if (!error) {
201 error = swsusp_resume(); 205 error = swsusp_resume();
202 device_resume(); 206 device_resume();
203 } 207 }
208 resume_console();
204 pm_restore_console(); 209 pm_restore_console();
205 up(&pm_sem); 210 up(&pm_sem);
206 break; 211 break;
@@ -289,6 +294,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
289 } 294 }
290 295
291 /* Put devices to sleep */ 296 /* Put devices to sleep */
297 suspend_console();
292 error = device_suspend(PMSG_SUSPEND); 298 error = device_suspend(PMSG_SUSPEND);
293 if (error) { 299 if (error) {
294 printk(KERN_ERR "Failed to suspend some devices.\n"); 300 printk(KERN_ERR "Failed to suspend some devices.\n");
@@ -299,7 +305,7 @@ static int snapshot_ioctl(struct inode *inode, struct file *filp,
299 /* Wake up devices */ 305 /* Wake up devices */
300 device_resume(); 306 device_resume();
301 } 307 }
302 308 resume_console();
303 if (pm_ops->finish) 309 if (pm_ops->finish)
304 pm_ops->finish(PM_SUSPEND_MEM); 310 pm_ops->finish(PM_SUSPEND_MEM);
305 311
diff --git a/kernel/printk.c b/kernel/printk.c
index 771f5e861b..f7d427ef50 100644
--- a/kernel/printk.c
+++ b/kernel/printk.c
@@ -820,15 +820,8 @@ void release_console_sem(void)
820 console_locked = 0; 820 console_locked = 0;
821 up(&console_sem); 821 up(&console_sem);
822 spin_unlock_irqrestore(&logbuf_lock, flags); 822 spin_unlock_irqrestore(&logbuf_lock, flags);
823 if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait)) { 823 if (wake_klogd && !oops_in_progress && waitqueue_active(&log_wait))
824 /* 824 wake_up_interruptible(&log_wait);
825 * If we printk from within the lock dependency code,
826 * from within the scheduler code, then do not lock
827 * up due to self-recursion:
828 */
829 if (!lockdep_internal())
830 wake_up_interruptible(&log_wait);
831 }
832} 825}
833EXPORT_SYMBOL(release_console_sem); 826EXPORT_SYMBOL(release_console_sem);
834 827
diff --git a/kernel/profile.c b/kernel/profile.c
index 857300a2af..f940b462ee 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -399,7 +399,7 @@ static int prof_cpu_mask_write_proc (struct file *file, const char __user *buffe
399 unsigned long full_count = count, err; 399 unsigned long full_count = count, err;
400 cpumask_t new_value; 400 cpumask_t new_value;
401 401
402 err = cpumask_parse(buffer, count, new_value); 402 err = cpumask_parse_user(buffer, count, new_value);
403 if (err) 403 if (err)
404 return err; 404 return err;
405 405
diff --git a/kernel/relay.c b/kernel/relay.c
index 1d63ecddfa..f04bbdb56a 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -887,7 +887,7 @@ static int subbuf_read_actor(size_t read_start,
887 887
888 from = buf->start + read_start; 888 from = buf->start + read_start;
889 ret = avail; 889 ret = avail;
890 if (copy_to_user(desc->arg.data, from, avail)) { 890 if (copy_to_user(desc->arg.buf, from, avail)) {
891 desc->error = -EFAULT; 891 desc->error = -EFAULT;
892 ret = 0; 892 ret = 0;
893 } 893 }
@@ -946,24 +946,17 @@ typedef int (*subbuf_actor_t) (size_t read_start,
946 */ 946 */
947static inline ssize_t relay_file_read_subbufs(struct file *filp, 947static inline ssize_t relay_file_read_subbufs(struct file *filp,
948 loff_t *ppos, 948 loff_t *ppos,
949 size_t count,
950 subbuf_actor_t subbuf_actor, 949 subbuf_actor_t subbuf_actor,
951 read_actor_t actor, 950 read_actor_t actor,
952 void *target) 951 read_descriptor_t *desc)
953{ 952{
954 struct rchan_buf *buf = filp->private_data; 953 struct rchan_buf *buf = filp->private_data;
955 size_t read_start, avail; 954 size_t read_start, avail;
956 read_descriptor_t desc;
957 int ret; 955 int ret;
958 956
959 if (!count) 957 if (!desc->count)
960 return 0; 958 return 0;
961 959
962 desc.written = 0;
963 desc.count = count;
964 desc.arg.data = target;
965 desc.error = 0;
966
967 mutex_lock(&filp->f_dentry->d_inode->i_mutex); 960 mutex_lock(&filp->f_dentry->d_inode->i_mutex);
968 do { 961 do {
969 if (!relay_file_read_avail(buf, *ppos)) 962 if (!relay_file_read_avail(buf, *ppos))
@@ -974,19 +967,19 @@ static inline ssize_t relay_file_read_subbufs(struct file *filp,
974 if (!avail) 967 if (!avail)
975 break; 968 break;
976 969
977 avail = min(desc.count, avail); 970 avail = min(desc->count, avail);
978 ret = subbuf_actor(read_start, buf, avail, &desc, actor); 971 ret = subbuf_actor(read_start, buf, avail, desc, actor);
979 if (desc.error < 0) 972 if (desc->error < 0)
980 break; 973 break;
981 974
982 if (ret) { 975 if (ret) {
983 relay_file_read_consume(buf, read_start, ret); 976 relay_file_read_consume(buf, read_start, ret);
984 *ppos = relay_file_read_end_pos(buf, read_start, ret); 977 *ppos = relay_file_read_end_pos(buf, read_start, ret);
985 } 978 }
986 } while (desc.count && ret); 979 } while (desc->count && ret);
987 mutex_unlock(&filp->f_dentry->d_inode->i_mutex); 980 mutex_unlock(&filp->f_dentry->d_inode->i_mutex);
988 981
989 return desc.written; 982 return desc->written;
990} 983}
991 984
992static ssize_t relay_file_read(struct file *filp, 985static ssize_t relay_file_read(struct file *filp,
@@ -994,8 +987,13 @@ static ssize_t relay_file_read(struct file *filp,
994 size_t count, 987 size_t count,
995 loff_t *ppos) 988 loff_t *ppos)
996{ 989{
997 return relay_file_read_subbufs(filp, ppos, count, subbuf_read_actor, 990 read_descriptor_t desc;
998 NULL, buffer); 991 desc.written = 0;
992 desc.count = count;
993 desc.arg.buf = buffer;
994 desc.error = 0;
995 return relay_file_read_subbufs(filp, ppos, subbuf_read_actor,
996 NULL, &desc);
999} 997}
1000 998
1001static ssize_t relay_file_sendfile(struct file *filp, 999static ssize_t relay_file_sendfile(struct file *filp,
@@ -1004,8 +1002,13 @@ static ssize_t relay_file_sendfile(struct file *filp,
1004 read_actor_t actor, 1002 read_actor_t actor,
1005 void *target) 1003 void *target)
1006{ 1004{
1007 return relay_file_read_subbufs(filp, ppos, count, subbuf_send_actor, 1005 read_descriptor_t desc;
1008 actor, target); 1006 desc.written = 0;
1007 desc.count = count;
1008 desc.arg.data = target;
1009 desc.error = 0;
1010 return relay_file_read_subbufs(filp, ppos, subbuf_send_actor,
1011 actor, &desc);
1009} 1012}
1010 1013
1011struct file_operations relay_file_operations = { 1014struct file_operations relay_file_operations = {
diff --git a/kernel/sched.c b/kernel/sched.c
index 53608a59d6..094b5687ee 100644
--- a/kernel/sched.c
+++ b/kernel/sched.c
@@ -1822,14 +1822,14 @@ context_switch(struct rq *rq, struct task_struct *prev,
1822 struct mm_struct *mm = next->mm; 1822 struct mm_struct *mm = next->mm;
1823 struct mm_struct *oldmm = prev->active_mm; 1823 struct mm_struct *oldmm = prev->active_mm;
1824 1824
1825 if (unlikely(!mm)) { 1825 if (!mm) {
1826 next->active_mm = oldmm; 1826 next->active_mm = oldmm;
1827 atomic_inc(&oldmm->mm_count); 1827 atomic_inc(&oldmm->mm_count);
1828 enter_lazy_tlb(oldmm, next); 1828 enter_lazy_tlb(oldmm, next);
1829 } else 1829 } else
1830 switch_mm(oldmm, mm, next); 1830 switch_mm(oldmm, mm, next);
1831 1831
1832 if (unlikely(!prev->mm)) { 1832 if (!prev->mm) {
1833 prev->active_mm = NULL; 1833 prev->active_mm = NULL;
1834 WARN_ON(rq->prev_mm); 1834 WARN_ON(rq->prev_mm);
1835 rq->prev_mm = oldmm; 1835 rq->prev_mm = oldmm;
@@ -3491,7 +3491,7 @@ asmlinkage void __sched preempt_schedule(void)
3491 * If there is a non-zero preempt_count or interrupts are disabled, 3491 * If there is a non-zero preempt_count or interrupts are disabled,
3492 * we do not want to preempt the current task. Just return.. 3492 * we do not want to preempt the current task. Just return..
3493 */ 3493 */
3494 if (unlikely(ti->preempt_count || irqs_disabled())) 3494 if (likely(ti->preempt_count || irqs_disabled()))
3495 return; 3495 return;
3496 3496
3497need_resched: 3497need_resched:
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index cfc737bffe..3df9bfc7ff 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -28,6 +28,7 @@
28#include <linux/notifier.h> 28#include <linux/notifier.h>
29#include <linux/kthread.h> 29#include <linux/kthread.h>
30#include <linux/hardirq.h> 30#include <linux/hardirq.h>
31#include <linux/mempolicy.h>
31 32
32/* 33/*
33 * The per-CPU workqueue (if single thread, we always use the first 34 * The per-CPU workqueue (if single thread, we always use the first
@@ -245,6 +246,12 @@ static int worker_thread(void *__cwq)
245 sigprocmask(SIG_BLOCK, &blocked, NULL); 246 sigprocmask(SIG_BLOCK, &blocked, NULL);
246 flush_signals(current); 247 flush_signals(current);
247 248
249 /*
250 * We inherited MPOL_INTERLEAVE from the booting kernel.
251 * Set MPOL_DEFAULT to insure node local allocations.
252 */
253 numa_default_policy();
254
248 /* SIG_IGN makes children autoreap: see do_notify_parent(). */ 255 /* SIG_IGN makes children autoreap: see do_notify_parent(). */
249 sa.sa.sa_handler = SIG_IGN; 256 sa.sa.sa_handler = SIG_IGN;
250 sa.sa.sa_flags = 0; 257 sa.sa.sa_flags = 0;