05/10/2022 00:09, Reshma Pattan:
> From: Hamza Khan <hamza.k...@intel.com>
> 
> Currently, when vm_power_manager exits, we are using a LIST_FOREACH
> macro to iterate over VM info structures while freeing them. This
> leads to use-after-free error. To address this, replace all usages of
> LIST_* with TAILQ_* macros, and use the RTE_TAILQ_FOREACH_SAFE macro
> to iterate and delete VM info structures.
> 
> Fixes: e8ae9b662506 ("examples/vm_power: channel manager and monitor in host")
> Cc: alan.ca...@intel.com
> Cc: sta...@dpdk.org
> 
> Signed-off-by: Hamza Khan <hamza.k...@intel.com>
> Signed-off-by: Reshma Pattan <reshma.pat...@intel.com>
> Acked-by: David Hunt <david.h...@intel.com>
> ---
>  examples/vm_power_manager/channel_manager.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)
> 
> diff --git a/examples/vm_power_manager/channel_manager.c 
> b/examples/vm_power_manager/channel_manager.c
> index 838465ab4b..cb872ad2d5 100644
> --- a/examples/vm_power_manager/channel_manager.c
> +++ b/examples/vm_power_manager/channel_manager.c
> @@ -22,6 +22,7 @@
>  #include <rte_mempool.h>
>  #include <rte_log.h>
>  #include <rte_spinlock.h>
> +#include <rte_tailq.h>
>  
>  #include <libvirt/libvirt.h>
>  
> @@ -30,6 +31,7 @@
>  #include "power_manager.h"
>  
>  
> +
>  #define RTE_LOGTYPE_CHANNEL_MANAGER RTE_LOGTYPE_USER1

I suppose we don't need a third blank line here.
Removing.

[...]
> -     LIST_FOREACH(vm_info, &vm_list_head, vms_info) {
> +     RTE_TAILQ_FOREACH_SAFE(vm_info, &vm_list_head, vms_info, tmp) {

Applied, thanks.


Reply via email to