[PATCH] refperf: Remove redundant kfree() after torture_stop_kthread()
From: Kaushlendra Kumar
Date: Tue Sep 09 2025 - 01:43:46 EST
Remove unnecessary kfree(main_task) call in ref_scale_cleanup() as
torture_stop_kthread() already handles the memory cleanup for the
task structure internally.
The torture_stop_kthread() function is designed to stop the kernel
thread and free the associated task structure as part of its cleanup
process. The additional kfree(main_task) call after torture_stop_kthread()
results in a double-free condition.
This pattern is consistent with other torture test modules where
torture_stop_kthread() is called without explicit kfree() of the
task pointer, as the torture framework manages the task lifecycle
internally.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@xxxxxxxxx>
---
kernel/rcu/refscale.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/kernel/rcu/refscale.c b/kernel/rcu/refscale.c
index 2c2648a3ad30..2bfa987f4ba9 100644
--- a/kernel/rcu/refscale.c
+++ b/kernel/rcu/refscale.c
@@ -1050,7 +1050,6 @@ ref_scale_cleanup(void)
kfree(reader_tasks);
torture_stop_kthread("main_task", main_task);
- kfree(main_task);
// Do scale-type-specific cleanup operations.
if (cur_ops->cleanup != NULL)
--
2.34.1