DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Reshma Pattan <reshma.pattan@intel.com>
Cc: dev@dpdk.org, Hamza Khan <hamza.khan@intel.com>,
	stable@dpdk.org, David Hunt <david.hunt@intel.com>,
	bruce.richardson@intel.com
Subject: Re: [PATCH v5] examples/vm_power_manager: use safe version of list iterator
Date: Wed, 05 Oct 2022 12:17:49 +0200	[thread overview]
Message-ID: <8583621.OUTRe80PYV@thomas> (raw)
In-Reply-To: <20221004220904.474852-1-reshma.pattan@intel.com>

05/10/2022 00:09, Reshma Pattan:
> From: Hamza Khan <hamza.khan@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.carew@intel.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Hamza Khan <hamza.khan@intel.com>
> Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
> Acked-by: David Hunt <david.hunt@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	other threads:[~2022-10-05 10:17 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-01 10:54 [PATCH 1/2] common: add safe version of foreach-list to Linux Hamza Khan
2022-06-01 10:54 ` [PATCH 2/2] examples/vm_power_manager: use safe version of list iterator Hamza Khan
2022-07-04 12:31   ` Hunt, David
2022-07-05  2:38     ` Li, WeiyuanX
2022-07-04 13:45 ` [PATCH 1/2] common: add safe version of foreach-list to Linux Khan, Hamza
2022-07-05 16:16 ` Thomas Monjalon
2022-07-07 15:59   ` Khan, Hamza
2022-07-07 19:09     ` Thomas Monjalon
2022-07-08  8:56       ` Khan, Hamza
2022-07-08  9:25         ` Thomas Monjalon
2022-07-08  9:28           ` Khan, Hamza
2022-07-07 15:48 ` [PATCH v2] examples/vm_power_manager: use safe version of list iterator Hamza Khan
2022-07-08  8:51 ` [PATCH v3] " Hamza Khan
2022-07-08  9:28   ` Hunt, David
2022-07-19 18:25   ` Pattan, Reshma
2022-08-22 10:58   ` [PATCH v4] " Reshma Pattan
2022-08-22 11:29     ` Hunt, David
2022-10-04 22:09     ` [PATCH v5] " Reshma Pattan
2022-10-05 10:17       ` Thomas Monjalon [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8583621.OUTRe80PYV@thomas \
    --to=thomas@monjalon.net \
    --cc=bruce.richardson@intel.com \
    --cc=david.hunt@intel.com \
    --cc=dev@dpdk.org \
    --cc=hamza.khan@intel.com \
    --cc=reshma.pattan@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).