Calling del_timer_sync() on an uninitialized timer leads to a never ending loop in lock_timer_base() that spins checking for a non-NULL timer base. Add an assertion to debugobjects to catch usage of uninitialized objects so that we can initialize timers in the del_timer_sync() path before it calls lock_timer_base(). [ sboyd@codeaurora.org: Clarify commit message ]
Showing the changes to lib/debugobjects.c (1 of 3 files). Show all
Unified · Split
| @@ -570,6 +570,44 @@ out_unlock: · 569 unmodified lines | |||
| 570 | raw_spin_unlock_irqrestore(&db->lock, flags); | 570 | raw_spin_unlock_irqrestore(&db->lock, flags); |
| 571 | } | 571 | } |
| 572 | 572 | ||
| 573 | /** | ||
| 574 | * debug_object_assert_init - debug checks when object should be init-ed | ||
| 575 | * @addr: address of the object | ||
| 576 | * @descr: pointer to an object specific debug description structure | ||
| 577 | */ | ||
| 578 | void debug_object_assert_init(void *addr, struct debug_obj_descr *descr) | ||
| 579 | { | ||
| 580 | struct debug_bucket *db; | ||
| 581 | struct debug_obj *obj; | ||
| 582 | unsigned long flags; | ||
| 583 | |||
| 584 | if (!debug_objects_enabled) | ||
| 585 | return; | ||
| 586 | |||
| 587 | db = get_bucket((unsigned long) addr); | ||
| 588 | |||
| 589 | raw_spin_lock_irqsave(&db->lock, flags); | ||
| 590 | |||
| 591 | obj = lookup_object(addr, db); | ||
| 592 | if (!obj) { | ||
| 593 | struct debug_obj o = { .object = addr, | ||
| 594 | .state = ODEBUG_STATE_NOTAVAILABLE, | ||
| 595 | .descr = descr }; | ||
| 596 | |||
| 597 | raw_spin_unlock_irqrestore(&db->lock, flags); | ||
| 598 | /* | ||
| 599 | * Maybe the object is static. Let the type specific | ||
| 600 | * code decide what to do. | ||
| 601 | */ | ||
| 602 | if (debug_object_fixup(descr->fixup_assert_init, addr, | ||
| 603 | ODEBUG_STATE_NOTAVAILABLE)) | ||
| 604 | debug_print_object(&o, "assert_init"); | ||
| 605 | return; | ||
| 606 | } | ||
| 607 | |||
| 608 | raw_spin_unlock_irqrestore(&db->lock, flags); | ||
| 609 | } | ||
| 610 | |||
| 573 | /** | 611 | /** |
| 574 | * debug_object_active_state - debug checks object usage state machine | 612 | * debug_object_active_state - debug checks object usage state machine |
| 575 | * @addr: address of the object | 613 | * @addr: address of the object |