Skip to content

Commit

Permalink
async: initialise list heads to fix crash
Browse files Browse the repository at this point in the history
9fdb04c ("async: replace list of active domains with global list
of pending items") added a struct list_head global_list in struct
async_entry, which isn't initialised.  This means that if
!domain->registered at __async_schedule(), then list_del_init() will
be called on the list head in async_run_entry_fn with both pointers
NULL, causing a crash.  This is fixed by initialising both the
global_list and domain_list list_heads after kzalloc'ing the entry.

This was noticed due to dapm_power_widgets() which uses
ASYNC_DOMAIN_EXCLUSIVE, which initialises the domain->registered to 0.

Signed-off-by: James Hogan <[email protected]>
Signed-off-by: Tejun Heo <[email protected]>
Reported-by: James Hogan <[email protected]>
Reported-by: Stephen Warren <[email protected]>
  • Loading branch information
James Hogan authored and htejun committed Jan 25, 2013
1 parent 9fdb04c commit a0327ff
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions kernel/async.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ static async_cookie_t __async_schedule(async_func_ptr *ptr, void *data, struct a
ptr(data, newcookie);
return newcookie;
}
INIT_LIST_HEAD(&entry->domain_list);
INIT_LIST_HEAD(&entry->global_list);
INIT_WORK(&entry->work, async_run_entry_fn);
entry->func = ptr;
entry->data = data;
Expand Down

0 comments on commit a0327ff

Please sign in to comment.