From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 403BFA0542;
	Wed,  5 Oct 2022 12:17:55 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D632B40A7D;
	Wed,  5 Oct 2022 12:17:54 +0200 (CEST)
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com
 [66.111.4.27]) by mails.dpdk.org (Postfix) with ESMTP id 795AC40694;
 Wed,  5 Oct 2022 12:17:53 +0200 (CEST)
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailout.nyi.internal (Postfix) with ESMTP id 28BC85C0132;
 Wed,  5 Oct 2022 06:17:52 -0400 (EDT)
Received: from mailfrontend2 ([10.202.2.163])
 by compute2.internal (MEProxy); Wed, 05 Oct 2022 06:17:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h=
 cc:cc:content-transfer-encoding:content-type:date:date:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to; s=fm2; t=1664965072; x=
 1665051472; bh=go9Oiw0QnmUwXWJtxyC1ERQM5CTpO2FY6FITVZCqhrY=; b=y
 Vuany2P177K4rBcUi0Lk0sgpiw+KAZontPkqHJKJkPPMvkQRvR/H3/bXmbi4Asy1
 hIbLJGqzFIUDZ9JUvFnUxYez1QrGi6yPcylUM2yCpI0muvYWtJhgk/TXVG9oYEtj
 cAQTa+zmaHPo2AJb0ABlqKZfzMX1LaA3+/ITvmRk0i2t77+spQkTtV3u1TB2XiWD
 VQ0RdsOfVygd5YeZ0ma7RfoswxlScZhaDD2AW5b4S0tfUe39A7eXl17RsYib22EG
 +zmQ07vYa2PJzu5MwrKsBlvg8NVZTthD0AKriGsKxyOfnvMvcYpJvJb01UoabNup
 gDI6EoQ72+mF7BaP/sKMA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-transfer-encoding
 :content-type:date:date:feedback-id:feedback-id:from:from
 :in-reply-to:in-reply-to:message-id:mime-version:references
 :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy
 :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1664965072; x=
 1665051472; bh=go9Oiw0QnmUwXWJtxyC1ERQM5CTpO2FY6FITVZCqhrY=; b=O
 opYmFdQ8gEnvlyuPPIhF0n0p4+vKeIknf87xHE6gnQ5CTvM7hyR8PZQjA6nksYIv
 4ol0w0WP5BHRM6AayIV5ynwY6BRpVutZSGLU7Y02+/4hchyzSoVwqT5Ij4Je5jV1
 w1RSgdYC/xrNXmTz0gaTL79rp9PmQ9B/pH2Q7/vNF1Z0HPto2xnrqKV9cqWQhE36
 UhQxeWuAO6Ts8fZzZEqKlSLU45ZkolSJiBAO7XqjtZRlPPeCKtitYcJy/XU608eV
 zUfpnHJ2NJaUNNcmrn/w8UKBb0McEH8uH6j9xEZ6ZhDz1HT4eFpiQ1ytfWwSsMNn
 w9lAAputbZnSiyKmNBzbg==
X-ME-Sender: <xms:z1k9Y-JVANHuWY6SVtOxxPwcG6gIAY5WsaCSpNMqnI6cxf-E2MQryA>
 <xme:z1k9Y2K5m7rt-vp4tWKkluBnZchM012xe85vTBrmu2I775WUgTXT59bD1nBEq7Bqg
 dsWpQVnNZ5X63HzJg>
X-ME-Received: <xmr:z1k9Y-tSlDZWwlTrX5nGWty0V5nDV4bLDwZdXNHBpbcsRKktFdFGb8HLBEssbUGU-3vQL7-BG2FL-9tEufynsYL0Uw>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeifedgvdehucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm
 rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc
 ggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvdelteeufeefheeujefgueetfedttdei
 kefgkeduhedtgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh
 hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght
X-ME-Proxy: <xmx:0Fk9YzbcLf-WzW6lJH5ayzFbUIbgyF3PJblWhFDAsBIPJhn7GCtZcw>
 <xmx:0Fk9Y1YLa-wF-DlSk9hG_L10PpaVrjWaDuW5pggldKi1LPfs8djLCA>
 <xmx:0Fk9Y_Cz8V0uv-pUmQExTFQGNUZa2sbC4LLejm1o7iAC9ol-CiGA3A>
 <xmx:0Fk9Y0U-LVlimOzDCJuOpPZEMYZHdld94tnJFtgxgrPlwtddOs0xqQ>
Feedback-ID: i47234305:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed,
 5 Oct 2022 06:17:51 -0400 (EDT)
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
Message-ID: <8583621.OUTRe80PYV@thomas>
In-Reply-To: <20221004220904.474852-1-reshma.pattan@intel.com>
References: <20220822105855.6180-1-reshma.pattan@intel.com>
 <20221004220904.474852-1-reshma.pattan@intel.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7Bit
Content-Type: text/plain; charset="us-ascii"
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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.