diff options
author | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-02-18 01:12:18 -0500 |
---|---|---|
committer | Paul E. McKenney <paulmck@linux.vnet.ibm.com> | 2012-04-24 23:55:39 -0400 |
commit | 37e377d2823e03528cb64f435d7c0e30b1c668eb (patch) | |
tree | 4cad4e769f6e244886649001a91de85a3a2c80ce /kernel/rcutorture.c | |
parent | 66f75a5d028beaf67c931435fdc3e7823125730c (diff) |
rcu: Fixes to rcutorture error handling and cleanup
The rcutorture initialization code ignored the error returns from
rcu_torture_onoff_init() and rcu_torture_stall_init(). The rcutorture
cleanup code failed to NULL out a number of pointers. These bugs will
normally have no effect, but this commit fixes them nevertheless.
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Diffstat (limited to 'kernel/rcutorture.c')
-rw-r--r-- | kernel/rcutorture.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index a89b381a8c6e..1463a0636443 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -1337,6 +1337,7 @@ static void rcutorture_booster_cleanup(int cpu) | |||
1337 | 1337 | ||
1338 | /* This must be outside of the mutex, otherwise deadlock! */ | 1338 | /* This must be outside of the mutex, otherwise deadlock! */ |
1339 | kthread_stop(t); | 1339 | kthread_stop(t); |
1340 | boost_tasks[cpu] = NULL; | ||
1340 | } | 1341 | } |
1341 | 1342 | ||
1342 | static int rcutorture_booster_init(int cpu) | 1343 | static int rcutorture_booster_init(int cpu) |
@@ -1484,13 +1485,15 @@ static void rcu_torture_onoff_cleanup(void) | |||
1484 | return; | 1485 | return; |
1485 | VERBOSE_PRINTK_STRING("Stopping rcu_torture_onoff task"); | 1486 | VERBOSE_PRINTK_STRING("Stopping rcu_torture_onoff task"); |
1486 | kthread_stop(onoff_task); | 1487 | kthread_stop(onoff_task); |
1488 | onoff_task = NULL; | ||
1487 | } | 1489 | } |
1488 | 1490 | ||
1489 | #else /* #ifdef CONFIG_HOTPLUG_CPU */ | 1491 | #else /* #ifdef CONFIG_HOTPLUG_CPU */ |
1490 | 1492 | ||
1491 | static void | 1493 | static int |
1492 | rcu_torture_onoff_init(void) | 1494 | rcu_torture_onoff_init(void) |
1493 | { | 1495 | { |
1496 | return 0; | ||
1494 | } | 1497 | } |
1495 | 1498 | ||
1496 | static void rcu_torture_onoff_cleanup(void) | 1499 | static void rcu_torture_onoff_cleanup(void) |
@@ -1554,6 +1557,7 @@ static void rcu_torture_stall_cleanup(void) | |||
1554 | return; | 1557 | return; |
1555 | VERBOSE_PRINTK_STRING("Stopping rcu_torture_stall_task."); | 1558 | VERBOSE_PRINTK_STRING("Stopping rcu_torture_stall_task."); |
1556 | kthread_stop(stall_task); | 1559 | kthread_stop(stall_task); |
1560 | stall_task = NULL; | ||
1557 | } | 1561 | } |
1558 | 1562 | ||
1559 | static int rcutorture_cpu_notify(struct notifier_block *self, | 1563 | static int rcutorture_cpu_notify(struct notifier_block *self, |
@@ -1665,6 +1669,7 @@ rcu_torture_cleanup(void) | |||
1665 | VERBOSE_PRINTK_STRING("Stopping rcu_torture_shutdown task"); | 1669 | VERBOSE_PRINTK_STRING("Stopping rcu_torture_shutdown task"); |
1666 | kthread_stop(shutdown_task); | 1670 | kthread_stop(shutdown_task); |
1667 | } | 1671 | } |
1672 | shutdown_task = NULL; | ||
1668 | rcu_torture_onoff_cleanup(); | 1673 | rcu_torture_onoff_cleanup(); |
1669 | 1674 | ||
1670 | /* Wait for all RCU callbacks to fire. */ | 1675 | /* Wait for all RCU callbacks to fire. */ |
@@ -1897,9 +1902,17 @@ rcu_torture_init(void) | |||
1897 | goto unwind; | 1902 | goto unwind; |
1898 | } | 1903 | } |
1899 | } | 1904 | } |
1900 | rcu_torture_onoff_init(); | 1905 | i = rcu_torture_onoff_init(); |
1906 | if (i != 0) { | ||
1907 | firsterr = i; | ||
1908 | goto unwind; | ||
1909 | } | ||
1901 | register_reboot_notifier(&rcutorture_shutdown_nb); | 1910 | register_reboot_notifier(&rcutorture_shutdown_nb); |
1902 | rcu_torture_stall_init(); | 1911 | i = rcu_torture_stall_init(); |
1912 | if (i != 0) { | ||
1913 | firsterr = i; | ||
1914 | goto unwind; | ||
1915 | } | ||
1903 | rcutorture_record_test_transition(); | 1916 | rcutorture_record_test_transition(); |
1904 | mutex_unlock(&fullstop_mutex); | 1917 | mutex_unlock(&fullstop_mutex); |
1905 | return 0; | 1918 | return 0; |