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 8EB62A0540; Mon, 4 Jul 2022 14:34:10 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E313D427F0; Mon, 4 Jul 2022 14:34:09 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mails.dpdk.org (Postfix) with ESMTP id 44F1340E09; Mon, 4 Jul 2022 14:34:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656938047; x=1688474047; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=mGGk8zGDp9fUB5mm5IeXjOq5g99cSLWCcGq2oI766jE=; b=gAbYGxZFwwYeCkag5IHzYh2rY6kykRCVl9QH2i/mNeqFTmnmSzziM70g 5FAwExU3DIQwwDbc19bSf6nOkZ5tM/NHolWw0Lagw2Dv6JXHJ+VBbfIGP X1AFGDHQjNXPjTf4W4mJC+CLxIvTQdneylCCKeFf+pg/AtOicf/Limr8c DhB8bv2hdqqXR2zqsb4gIpzu5AaJscVireJVa9NuYM807aBydLYJFVrIa cvCVc5CTxDG65ASqbidGszJd5/dVFdZ3Fht6pEZ6IUnXjrVI5sHFhA5E+ 8yohgmV03Yet/VAabgAHK3Km/gMCC5dNfoaIgZzFelYofyt7qzggaCEY0 A==; X-IronPort-AV: E=McAfee;i="6400,9594,10397"; a="262911536" X-IronPort-AV: E=Sophos;i="5.92,243,1650956400"; d="scan'208";a="262911536" Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Jul 2022 05:31:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,243,1650956400"; d="scan'208";a="660195696" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga004.fm.intel.com with ESMTP; 04 Jul 2022 05:31:53 -0700 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Mon, 4 Jul 2022 05:31:53 -0700 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Mon, 4 Jul 2022 05:31:53 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Mon, 4 Jul 2022 05:31:53 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Fcnd/QlzsAa/L1U1/pHw+Vz/qB+BBhBuyJgj6oNGdzUOmrDjbbgorjoxjRiTjxWRzGh1eDEjdAjIN+swblfvUVQidcjGhnYm2HoTrbDV8qU6rK/32R+Q2BaW7av6KCJF+mh55cANd4S7rd/gdmopzoS5KcTlQvk+ArXdSraX7xBJFymMqYJeJKinzFAicyAbVk3TshposkXe375wriE6g60FUM5KbthHU0joWoN7STP4ndn5TTJGVl6lSY7mbbn2ABTGCdblkRgBVL7r9v5vaIamsjYwwjsNPRgj6sejsCroYgcaIWSKzwCf/jMq7brAasKpmNeayVH5RxwNHAN2NA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=mrsEJaaDyigNJfwQWxT9obmfVPeXoLmkRhB/SFLx/O4=; b=n8FUEJ6F7yhY7y4QVqLOQ1zGXg0XqXHY0iSIDZXy4dk0lGM7RFgQjBCWNsF4TH9PxTcMDKe6b0yWDCp1HF8ifflEyOrm0iCInN6XLeblPEeLBSLDH7oEh9o1n8SDiEFXcV32NObIJ0ULzC8I/liot9NqhpfKuZuMVPA1Em77Ck7SSey2hb2ZEZsE7k3VF9dDSVF25gIws/B1H7ZSdjRG7f8AIo7Jq3UOOgNXWbO3mJ3CLA8u3SaOf1O/1II+MkwaBP+Vu7PZLOmi3Xf6Bth0TGhL4HuF6bOvtVkCqetrunamCKmJu4cjnbFJGgAayO4my/ypd6lpYfmDQZg5Eh1a2g== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from BYAPR11MB3799.namprd11.prod.outlook.com (2603:10b6:a03:fb::19) by MWHPR11MB0031.namprd11.prod.outlook.com (2603:10b6:301:69::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.20; Mon, 4 Jul 2022 12:31:51 +0000 Received: from BYAPR11MB3799.namprd11.prod.outlook.com ([fe80::1c02:23cc:c50f:aa92]) by BYAPR11MB3799.namprd11.prod.outlook.com ([fe80::1c02:23cc:c50f:aa92%4]) with mapi id 15.20.5395.014; Mon, 4 Jul 2022 12:31:51 +0000 Message-ID: <5a28e603-e360-2be4-ecc1-5b837e41e08e@intel.com> Date: Mon, 4 Jul 2022 13:31:45 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH 2/2] examples/vm_power_manager: use safe version of list iterator Content-Language: en-US To: Hamza Khan , Alan Carew , Pablo de Lara CC: , References: <20220601105455.166505-1-hamza.khan@intel.com> <20220601105455.166505-2-hamza.khan@intel.com> From: "Hunt, David" In-Reply-To: <20220601105455.166505-2-hamza.khan@intel.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: LO2P265CA0100.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:c::16) To BYAPR11MB3799.namprd11.prod.outlook.com (2603:10b6:a03:fb::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e7785eb2-09c1-48e9-df0f-08da5db92b93 X-MS-TrafficTypeDiagnostic: MWHPR11MB0031:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1RAzZW8iP1uAbKWLQ4+ByWRZT4hJDXq8ptT7YKHCn3/1C20DPgfwujqLiUXAlD8YSoKfTVAuqSywDHTd12eoGXnLo14papgzQDBCcrEdsd137TXtsQcyOmXefO5/g3eIc8aH4SpL0Io/gm8dELFDQ7zyXTL+o1hC5jis5gm1050iwA6TOsfOts8je22X3EwSGPRBes6zqHNMQaozORJsNoZ/5CUV5EZQ4mLYPVeH2+cLjDCSDXi4CET1XM/dJ/oSvbD4kBPTZeaO9VMCnGYzIYVuhrN0QHtYjStSwXnM6QNZppGfvVLmG6iFMLXO698PwVKDVGg2yhvflq8LvEelvb3giwInwG0KN+7faGZShyldG3CKSmQB0fxxn94EoCUgHXOkCMdwbdf18QDxsDgD0jzXN5gwg8k3xjMv8gCCdgCKS6A3nUtIbJ3Boukl4lRcCksi95VYGPkYMkFxHE4QXy1aDTRq60E63Z87KMkLsFtwaBFLcRIPc8++4KjglvrMVXpzAr87qADOTFl2Sp61P3s/BKz4y/yBp3vsKhzTW3tYhf9DKq7rK7gZh/HCiwFUu9g6pJ5CWgAxesdmH2X+dX7Rl9I0A4Ej2GzioUA/w5cL/z+QftGkhjiuXrf5XIWBZ5Bh9tk8Uvpt57+C+0JH1YI3Ukych6PdZEykxqA8motCi7/yPltQRIhUqROaBhwwSjVcAR6vNeLcJrECqn1N/VBpbwFk+Lpbc8HHqHdr8bgIhXAG4BEKwOZZAPCX5ve6nrNkb/kcuL24NJpJ5OCMlruJO5FWVSfTRU8PdZeXKWhYkXbCtWUUfHab5d5oSy32FxEmDYUgvoC/tnkl2IW0YIvUMKb5FP0E5lFms8M3p4o= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BYAPR11MB3799.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230016)(136003)(376002)(39860400002)(366004)(396003)(346002)(6636002)(31686004)(8676002)(86362001)(38100700002)(31696002)(450100002)(316002)(83380400001)(66476007)(6486002)(36756003)(66556008)(110136005)(82960400001)(4326008)(6666004)(53546011)(41300700001)(186003)(2616005)(8936002)(2906002)(478600001)(66946007)(26005)(6512007)(5660300002)(6506007)(43740500002)(45980500001); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dHpVSnhqV01jUmRKOUJmaFdYblFoRjFnVlhzTHRESDBxczZIcExiRUtFWEpq?= =?utf-8?B?YWRvOTR0dVFYcXN2VTZuR2JESERxWmNOS3NmMVAxeVBvZS9ja3o4OHhmSlVM?= =?utf-8?B?RjdvYTRCUWxmRmUrNUNaNVA4UEZ6eVNkNFoybmhhUHRvbEphNHUvTVNlbE8r?= =?utf-8?B?cytsTmVmQ1h6NTNCWm5HdkNOV3RsQUFWbzFNM0RuWXNacE1QUTIreU11dXJ5?= =?utf-8?B?VUNEK0FxYnowUmxDMDdTNGY4K1JkRUo2cWd4YmowMm55RkZob29TUHlQVzNR?= =?utf-8?B?TUFucFZMK05Ja1JxdE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ejh5cDA4T0diYWpVV2tDaE0rQ2Nt?= =?utf-8?Q?DVWCwWVOhyLpwYrLQqbJFoeXp?= X-MS-Exchange-CrossTenant-Network-Message-Id: e7785eb2-09c1-48e9-df0f-08da5db92b93 X-MS-Exchange-CrossTenant-AuthSource: BYAPR11MB3799.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2022 12:31:51.1540 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: t1+BA8FmzHqCMfjExY3oP96fsQpMSoU9zIcbMC/tG+iPvjkyQhWwgpWk2L+2gVzJGyh+oroWooaMmBhkzxnxeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR11MB0031 X-OriginatorOrg: intel.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On 01/06/2022 11:54, Hamza Khan wrote: > 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, use the newly added > LIST_FOREACH_SAFE macro. > > 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 > --- > examples/vm_power_manager/channel_manager.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c > index 838465ab4b..bc95cec8d6 100644 > --- a/examples/vm_power_manager/channel_manager.c > +++ b/examples/vm_power_manager/channel_manager.c > @@ -1005,9 +1005,9 @@ channel_manager_exit(void) > { > unsigned i; > char mask[RTE_MAX_LCORE]; > - struct virtual_machine_info *vm_info; > + struct virtual_machine_info *vm_info, *tmp; > > - LIST_FOREACH(vm_info, &vm_list_head, vms_info) { > + LIST_FOREACH_SAFE(vm_info, &vm_list_head, vms_info, tmp) { > > rte_spinlock_lock(&(vm_info->config_spinlock)); > Acked-by: David Hunt