Reviewed-by: Petri Savolainen <[email protected]>


> -----Original Message-----
> From: ext Nicolas Morey-Chaisemartin [mailto:[email protected]]
> Sent: Monday, June 15, 2015 4:31 PM
> To: [email protected]
> Cc: Savolainen, Petri (Nokia - FI/Espoo)
> Subject: [PATCH] linux-generic: schedule: fix double free
> 
> Buffer double free on schedule terminate introduced by
> 295d894a3e170f9f30261dc272182fb5eebd64b0
> 
> Signed-off-by: Nicolas Morey-Chaisemartin <[email protected]>
> ---
> This fixes an issue that can easily be reproduced by running the
> odp_scheduler validation test.
> Adding an assert allocator != ODP_FREEBUF in the odp_buffer_free function
> shows a double free in the odp_schedule_term_global function.
> 
> From what I could gather, the issue comes from the qe cmd_ev being freed
> by schedule_queue_destroy,
> and then freed again by odp_buffer_free (as it is the command pulled from
> the prio queue).
> 
> Running odp_buffer_free only if schedule_queue_destroy was not called
> fixes the issue.
> However I am not sure this won't cause mem leaks.
> 
>  platform/linux-generic/odp_schedule.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/platform/linux-generic/odp_schedule.c b/platform/linux-
> generic/odp_schedule.c
> index 7fe42d7..087ee67 100644
> --- a/platform/linux-generic/odp_schedule.c
> +++ b/platform/linux-generic/odp_schedule.c
> @@ -202,9 +202,8 @@ int odp_schedule_term_global(void)
> 
>                                       if (num > 0)
>                                               ODP_ERR("Queue not empty\n");
> -                             }
> -
> -                             odp_buffer_free(buf);
> +                             } else
> +                                     odp_buffer_free(buf);
>                       }
> 
>                       if (odp_queue_destroy(pri_q)) {
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to