Re: [greybus-dev] [PATCH] staging: greybus: use after free in gb_audio_manager_remove_all()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05-02-20, 15:32, Dan Carpenter wrote:
> 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: c77f85bbc91a ("greybus: audio: Fix incorrect counting of 'ida'")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> ---
>  drivers/staging/greybus/audio_manager.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/greybus/audio_manager.c b/drivers/staging/greybus/audio_manager.c
> index 9b19ea9d3fa1..9a3f7c034ab4 100644
> --- a/drivers/staging/greybus/audio_manager.c
> +++ b/drivers/staging/greybus/audio_manager.c
> @@ -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);

Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>

-- 
viresh



[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux