[PATCH v4 01/17] memzone: fix use after free in tracing

Burakov, Anatoly anatoly.burakov at intel.com
Tue Oct 1 14:17:14 CEST 2024


On 9/30/2024 8:43 PM, Stephen Hemminger wrote:
> Using the freed value for tracing is not a good idea.
> Although it is harmless for tracing, it will cause analyzers to flag
> this as unsafe.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> Acked-by: Chengwen Feng <fengchengwen at huawei.com>
> ---
>   lib/eal/common/eal_common_memzone.c | 3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/eal/common/eal_common_memzone.c b/lib/eal/common/eal_common_memzone.c
> index 2d9b6aa3e3..90efbb621d 100644
> --- a/lib/eal/common/eal_common_memzone.c
> +++ b/lib/eal/common/eal_common_memzone.c
> @@ -331,9 +331,10 @@ rte_memzone_free(const struct rte_memzone *mz)
>   
>   	rte_rwlock_write_unlock(&mcfg->mlock);
>   
> +	rte_eal_trace_memzone_free(name, addr, ret);
> +
>   	rte_free(addr);
>   
> -	rte_eal_trace_memzone_free(name, addr, ret);
>   	return ret;
>   }
>   
Acked-by: Anatoly Burakov <anatoly.burakov at intel.com>
-- 
Thanks,
Anatoly



More information about the dev mailing list