]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - kernel/watchdog.c
kernel/watchdog.c: avoid races between /proc handlers and CPU hotplug
[karo-tx-linux.git] / kernel / watchdog.c
index 0a23125369f14d4614131f407aa7f1ec87984fb1..13fdda1a4c91b52e14076026304b4188b49a4ad7 100644 (file)
@@ -719,6 +719,7 @@ int lockup_detector_suspend(void)
 {
        int ret = 0;
 
+       get_online_cpus();
        mutex_lock(&watchdog_proc_mutex);
        /*
         * Multiple suspend requests can be active in parallel (counted by
@@ -759,6 +760,7 @@ void lockup_detector_resume(void)
                watchdog_unpark_threads();
 
        mutex_unlock(&watchdog_proc_mutex);
+       put_online_cpus();
 }
 
 static int update_watchdog_all_cpus(void)
@@ -855,6 +857,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write,
        int err, old, new;
        int *watchdog_param = (int *)table->data;
 
+       get_online_cpus();
        mutex_lock(&watchdog_proc_mutex);
 
        if (watchdog_suspended) {
@@ -906,6 +909,7 @@ static int proc_watchdog_common(int which, struct ctl_table *table, int write,
        }
 out:
        mutex_unlock(&watchdog_proc_mutex);
+       put_online_cpus();
        return err;
 }
 
@@ -947,6 +951,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
 {
        int err, old;
 
+       get_online_cpus();
        mutex_lock(&watchdog_proc_mutex);
 
        if (watchdog_suspended) {
@@ -972,6 +977,7 @@ int proc_watchdog_thresh(struct ctl_table *table, int write,
        }
 out:
        mutex_unlock(&watchdog_proc_mutex);
+       put_online_cpus();
        return err;
 }
 
@@ -986,6 +992,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write,
 {
        int err;
 
+       get_online_cpus();
        mutex_lock(&watchdog_proc_mutex);
 
        if (watchdog_suspended) {
@@ -1013,6 +1020,7 @@ int proc_watchdog_cpumask(struct ctl_table *table, int write,
        }
 out:
        mutex_unlock(&watchdog_proc_mutex);
+       put_online_cpus();
        return err;
 }