[PATCH] smp: Fix missed destroy_work_on_stack() calls in smp_call_on_cpu()
From: Zqiang
Date: Thu Jul 04 2024 - 02:52:37 EST
For builts with CONFIG_DEBUG_OBJECTS_WORK=y kernels, the sscs.work
defined using INIT_WORK_ONSTACK() will be initialized by
debug_object_init_on_stack() for debug check in __init_work().
This commit therefore invoke destroy_work_on_stack() to free
sscs.work debug objects before smp_call_on_cpu() returns.
Signed-off-by: Zqiang <qiang.zhang1211@xxxxxxxxx>
---
kernel/smp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/smp.c b/kernel/smp.c
index cc13e73a887c..61f10f982341 100644
--- a/kernel/smp.c
+++ b/kernel/smp.c
@@ -1135,6 +1135,7 @@ int smp_call_on_cpu(unsigned int cpu, int (*func)(void *), void *par, bool phys)
queue_work_on(cpu, system_wq, &sscs.work);
wait_for_completion(&sscs.done);
+ destroy_work_on_stack(&sscs.work);
return sscs.ret;
}
--
2.17.1