浏览代码

rcutorture: Add missing destroy_timer_on_stack()

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 <tglx@linutronix.de>
Reviewed-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Thomas Gleixner 11 年之前
父节点
当前提交
424c1b6820
共有 1 个文件被更改,包括 3 次插入1 次删除
  1. 3 1
      kernel/rcu/rcutorture.c

+ 3 - 1
kernel/rcu/rcutorture.c

@@ -1023,8 +1023,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;
 }