x86/kaslr: Fix off-by-one error in process_gb_huge_pages()
[linux-2.6-microblaze.git] / kernel / sysctl.c
index 715774d..db1ce7a 100644 (file)
@@ -866,15 +866,23 @@ static int proc_taint(struct ctl_table *table, int write,
                return err;
 
        if (write) {
+               int i;
+
+               /*
+                * If we are relying on panic_on_taint not producing
+                * false positives due to userspace input, bail out
+                * before setting the requested taint flags.
+                */
+               if (panic_on_taint_nousertaint && (tmptaint & panic_on_taint))
+                       return -EINVAL;
+
                /*
                 * Poor man's atomic or. Not worth adding a primitive
                 * to everyone's atomic.h for this
                 */
-               int i;
-               for (i = 0; i < BITS_PER_LONG && tmptaint >> i; i++) {
-                       if ((tmptaint >> i) & 1)
+               for (i = 0; i < TAINT_FLAGS_COUNT; i++)
+                       if ((1UL << i) & tmptaint)
                                add_taint(i, LOCKDEP_STILL_OK);
-               }
        }
 
        return err;
@@ -2141,6 +2149,17 @@ static struct ctl_table kern_table[] = {
                .proc_handler   = proc_dointvec,
        },
 #endif
+#ifdef CONFIG_SMP
+       {
+               .procname       = "oops_all_cpu_backtrace",
+               .data           = &sysctl_oops_all_cpu_backtrace,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_ONE,
+       },
+#endif /* CONFIG_SMP */
        {
                .procname       = "pid_max",
                .data           = &pid_max,
@@ -2428,6 +2447,17 @@ static struct ctl_table kern_table[] = {
        },
 #endif
 #ifdef CONFIG_DETECT_HUNG_TASK
+#ifdef CONFIG_SMP
+       {
+               .procname       = "hung_task_all_cpu_backtrace",
+               .data           = &sysctl_hung_task_all_cpu_backtrace,
+               .maxlen         = sizeof(int),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec_minmax,
+               .extra1         = SYSCTL_ZERO,
+               .extra2         = SYSCTL_ONE,
+       },
+#endif /* CONFIG_SMP */
        {
                .procname       = "hung_task_panic",
                .data           = &sysctl_hung_task_panic,