History

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.

Thomas Gleixner committed 12 years ago

Commit ea2e64f1 parent 87291a92 files · +9 −0Browse files

Unified · Split

2 files
  1. include/linux/workqueue.h +2 −0
  2. kernel/workqueue.c +7 −0
include/linux/workqueue.h+2−0
@@ -191,6 +191,7 @@ struct execute_work { · 190 unmodified lines
191#ifdef CONFIG_DEBUG_OBJECTS_WORK191#ifdef CONFIG_DEBUG_OBJECTS_WORK
192extern void __init_work(struct work_struct *work, int onstack);192extern void __init_work(struct work_struct *work, int onstack);
193extern void destroy_work_on_stack(struct work_struct *work);193extern void destroy_work_on_stack(struct work_struct *work);
194extern void destroy_delayed_work_on_stack(struct delayed_work *work);
194static inline unsigned int work_static(struct work_struct *work)195static inline unsigned int work_static(struct work_struct *work)
195{196{
196 return *work_data_bits(work) & WORK_STRUCT_STATIC;197 return *work_data_bits(work) & WORK_STRUCT_STATIC;
@@ -198,6 +199,7 @@ static inline unsigned int work_static(struct work_struct *work) · 1 unmodified line
198#else199#else
199static inline void __init_work(struct work_struct *work, int onstack) { }200static inline void __init_work(struct work_struct *work, int onstack) { }
200static inline void destroy_work_on_stack(struct work_struct *work) { }201static inline void destroy_work_on_stack(struct work_struct *work) { }
202static inline void destroy_delayed_work_on_stack(struct delayed_work *work) { }
201static inline unsigned int work_static(struct work_struct *work) { return 0; }203static inline unsigned int work_static(struct work_struct *work) { return 0; }
202#endif204#endif
203 205
kernel/workqueue.c+7−0
@@ -516,6 +516,13 @@ void destroy_work_on_stack(struct work_struct *work) · 515 unmodified lines
516}516}
517EXPORT_SYMBOL_GPL(destroy_work_on_stack);517EXPORT_SYMBOL_GPL(destroy_work_on_stack);
518 518
519void destroy_delayed_work_on_stack(struct delayed_work *work)
520{
521 destroy_timer_on_stack(&work->timer);
522 debug_object_free(&work->work, &work_debug_descr);
523}
524EXPORT_SYMBOL_GPL(destroy_delayed_work_on_stack);
525
519#else526#else
520static inline void debug_work_activate(struct work_struct *work) { }527static inline void debug_work_activate(struct work_struct *work) { }
521static inline void debug_work_deactivate(struct work_struct *work) { }528static inline void debug_work_deactivate(struct work_struct *work) { }