Skip to content

Commit

Permalink
staging: greybus: use after free in gb_audio_manager_remove_all()
Browse files Browse the repository at this point in the history
When we call kobject_put() and it's the last reference to the kobject
then it calls gb_audio_module_release() and frees module.  We dereference
"module" on the next line which is a use after free.

Fixes: c77f85b ("greybus: audio: Fix incorrect counting of 'ida'")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Vaibhav Agarwal <vaibhav.sr@gmail.com>
Link: https://lore.kernel.org/r/20200205123217.jreendkyxulqsool@kili.mountain
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Dan Carpenter authored and Greg Kroah-Hartman committed Feb 10, 2020
1 parent c3709b3 commit b7db581
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/staging/greybus/audio_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ void gb_audio_manager_remove_all(void)

list_for_each_entry_safe(module, next, &modules_list, list) {
list_del(&module->list);
kobject_put(&module->kobj);
ida_simple_remove(&module_id, module->id);
kobject_put(&module->kobj);
}

is_empty = list_empty(&modules_list);
Expand Down

0 comments on commit b7db581

Please sign in to comment.