Skip to content

Commit a0327ff

Browse files
James Hoganhtejun
James Hogan
authored andcommitted
async: initialise list heads to fix crash
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 <james.hogan@imgtec.com> Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: James Hogan <james.hogan@imgtec.com> Reported-by: Stephen Warren <swarren@wwwdotorg.org>
1 parent 9fdb04c commit a0327ff

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

kernel/async.c

+2
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ static async_cookie_t __async_schedule(async_func_ptr *ptr, void *data, struct a
172172
ptr(data, newcookie);
173173
return newcookie;
174174
}
175+
INIT_LIST_HEAD(&entry->domain_list);
176+
INIT_LIST_HEAD(&entry->global_list);
175177
INIT_WORK(&entry->work, async_run_entry_fn);
176178
entry->func = ptr;
177179
entry->data = data;

0 commit comments

Comments
 (0)