diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2014-03-23 14:20:44 +0000 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2017-12-05 18:05:32 +0100 |
| commit | e11bd287e72e6c79b5c57472302b5f6eff64ae34 (patch) | |
| tree | ed3f44f7fdfbb4b2512f270e11de45f9a2fc6c03 | |
| parent | 787399c5d06a25b6e70e67bd5475a5b69cddd8f3 (diff) | |
workqueue: Provide destroy_delayed_work_on_stack()
If a delayed or deferrable work is on stack we need to tell debug
objects that we are destroying the timer and the work. Otherwise we
leak the tracking object.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Vince Weaver <vincent.weaver@maine.edu>
Acked-by: Tejun Heo <tj@kernel.org>
Link: http://lkml.kernel.org/r/20140323141939.911487677@linutronix.de
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
| -rw-r--r-- | include/linux/workqueue.h | 2 | ||||
| -rw-r--r-- | kernel/workqueue.c | 7 |
2 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index c69d2bc78..681f295b1 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -192,6 +192,7 @@ struct execute_work { #ifdef CONFIG_DEBUG_OBJECTS_WORK extern void __init_work(struct work_struct *work, int onstack); extern void destroy_work_on_stack(struct work_struct *work); +extern void destroy_delayed_work_on_stack(struct delayed_work *work); static inline unsigned int work_static(struct work_struct *work) { return *work_data_bits(work) & WORK_STRUCT_STATIC; @@ -199,6 +200,7 @@ static inline unsigned int work_static(struct work_struct *work) #else static inline void __init_work(struct work_struct *work, int onstack) { } static inline void destroy_work_on_stack(struct work_struct *work) { } +static inline void destroy_delayed_work_on_stack(struct delayed_work *work) { } static inline unsigned int work_static(struct work_struct *work) { return 0; } #endif diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 20e43cfc1..f8697219b 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -515,6 +515,13 @@ void destroy_work_on_stack(struct work_struct *work) } EXPORT_SYMBOL_GPL(destroy_work_on_stack); +void destroy_delayed_work_on_stack(struct delayed_work *work) +{ + destroy_timer_on_stack(&work->timer); + debug_object_free(&work->work, &work_debug_descr); +} +EXPORT_SYMBOL_GPL(destroy_delayed_work_on_stack); + #else static inline void debug_work_activate(struct work_struct *work) { } static inline void debug_work_deactivate(struct work_struct *work) { } |
