From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A535CA0543 for ; 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 99FE8410FB; Wed, 5 Oct 2022 12:17:55 +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: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeeifedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkjghfggfgtgesthfuredttddtvdenucfhrhhomhepvfhhohhm rghsucfoohhnjhgrlhhonhcuoehthhhomhgrshesmhhonhhjrghlohhnrdhnvghtqeenuc ggtffrrghtthgvrhhnpedtjeeiieefhedtfffgvdelteeufeefheeujefgueetfedttdei kefgkeduhedtgfenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehthhhomhgrshesmhhonhhjrghlohhnrdhnvght X-ME-Proxy: Feedback-ID: i47234305:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 5 Oct 2022 06:17:51 -0400 (EDT) From: Thomas Monjalon To: Reshma Pattan Cc: dev@dpdk.org, Hamza Khan , stable@dpdk.org, David Hunt , 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: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org 05/10/2022 00:09, Reshma Pattan: > From: Hamza Khan > > 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 > Signed-off-by: Reshma Pattan > Acked-by: David Hunt > --- > 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 > #include > #include > +#include > > #include > > @@ -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.