From: Thomas Gleixner <[email protected]>

The rcu_torture_reader() function uses an on-stack timer_list structure
which it initializes with setup_timer_on_stack().  However, it fails to
use destroy_timer_on_stack() before exiting, which results in leaking a
tracking object if DEBUG_OBJECTS is enabled.  This commit therefore
invokes destroy_timer_on_stack() to avoid this leakage.

Signed-off-by: Thomas Gleixner <[email protected]>
Reviewed-by: Josh Triplett <[email protected]>
Signed-off-by: Paul E. McKenney <[email protected]>
---
 kernel/rcu/rcutorture.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/rcu/rcutorture.c b/kernel/rcu/rcutorture.c
index 576d12263c81..a576583dd81e 100644
--- a/kernel/rcu/rcutorture.c
+++ b/kernel/rcu/rcutorture.c
@@ -1022,8 +1022,10 @@ rcu_torture_reader(void *arg)
                cond_resched();
                stutter_wait("rcu_torture_reader");
        } while (!torture_must_stop());
-       if (irqreader && cur_ops->irq_capable)
+       if (irqreader && cur_ops->irq_capable) {
                del_timer_sync(&t);
+               destroy_timer_on_stack(&t);
+       }
        torture_kthread_stopping("rcu_torture_reader");
        return 0;
 }
-- 
1.8.1.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to