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 ED0D241CBD for ; Fri, 17 Feb 2023 08:16:56 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E4B16410F6; Fri, 17 Feb 2023 08:16:56 +0100 (CET) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by mails.dpdk.org (Postfix) with ESMTP id 93BC340A8B; Fri, 17 Feb 2023 08:16:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1676618214; x=1708154214; h=message-id:date:subject:to:cc:references:from: in-reply-to:content-transfer-encoding:mime-version; bh=ZoRTY9YqgR3mCDBgHCTeXuZbru9MOFWUPtny4Af0IoM=; b=KRMKZLQmjqGnBXsANhL5/djmBEgI6TMtwBjC8DuIJd14NlBQ/e48x0YD Hfn2bp4ePSOEA/piSbISzwytNcvVc90pbf+aN5YZ10Y0KEK/FWeTHiDWC s2IhidFbxyQYfICZl/faSRjbB4cECmQ/Z0warKjt2AYgkC4BwbuLeA30Y OgYWe5cQTkDjxhwnfSL39v046Rv/OkYLPzF1oCElWGjHN94ooI1aWHSpU oiUI3es2r9nqfFpliUJTqKKLUw/FhxKWBrwx5ywJqVXevNcUp/PPZRL5y 4XEXr93k45oHQywz45sWB1hAG9J+1l3q/EdCl/wG8V90Yk473Qqzc2Eey Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="312297323" X-IronPort-AV: E=Sophos;i="5.97,304,1669104000"; d="scan'208";a="312297323" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Feb 2023 23:15:04 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10623"; a="759262162" X-IronPort-AV: E=Sophos;i="5.97,304,1669104000"; d="scan'208";a="759262162" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by FMSMGA003.fm.intel.com with ESMTP; 16 Feb 2023 23:15:04 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 16 Feb 2023 23:15:04 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 16 Feb 2023 23:15:03 -0800 Received: from FMSEDG603.ED.cps.intel.com (10.1.192.133) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Thu, 16 Feb 2023 23:15:03 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.169) by edgegateway.intel.com (192.55.55.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Thu, 16 Feb 2023 23:15:03 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K5OZ9jWHcL1idEK89JMRbxEsyUllop1yxDi5+OHgvE7Hu/MQ+eOW78tweybb3O9qq8dfjixdipzYF2KKlB3lHJQ28KQT2duyycXM3fyIjtg2ofhcginxyIT6XGWDY9ODd0uCGx35gutPNF4FUOdau08/tFi+a5TdY/nhjiItsv3jN4M+T8pp6V5nphxbH267mAXzTQ82IAPih+6ImUWwztCCZH17/eWoT5WfvpfqepHe1u/ZMlixlhvObi4EfS2c2Jfi54oljH2pDQbcxx+0OSfpNL2R+ltAsa8hnCUu07K5T3uu3a6DGUPTy0GjbSHbFzKYeLjpuoT3N2DCTnA/ug== 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=oC1FL19uZRhF+9qFhn1b0y6aZOJvPo7XZ2jk+yzLYUI=; b=dT3kQjrz1ePc2s/mWC/N/WcWiNi1JFa98Der9bPPjZo7bdJk7BJEcWzyqoB8vtMT1la/W/ucUgV+6sJgONCgyWEWdScQfz5GD87KWjuDZHLFjyfHcrYt24lJqo1R//8vAHvNPSZ+l4LJXTsjsSL6kAxZHOfPPyKQYUCDDUubaCpEm0jnIB8HX4swXk0KwbzTLYnOvbLWh9HtYsmwaFlIxK65N/ApYNy/YYMVmXiU0MJgGxnVMVJaok7eXnUjdr+yIjT7KhEogVaZNgQIkT4qpVGwZ3zWGdejJwqN/YoScdliKOO1l17xhwc9SVCCT8Gribu2vkawO6AUOTATPChE3Q== 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 CY4PR11MB0054.namprd11.prod.outlook.com (2603:10b6:910:79::27) by SJ2PR11MB7547.namprd11.prod.outlook.com (2603:10b6:a03:4cd::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Fri, 17 Feb 2023 07:15:01 +0000 Received: from CY4PR11MB0054.namprd11.prod.outlook.com ([fe80::66ef:d58d:35c6:65b3]) by CY4PR11MB0054.namprd11.prod.outlook.com ([fe80::66ef:d58d:35c6:65b3%7]) with mapi id 15.20.6111.013; Fri, 17 Feb 2023 07:15:01 +0000 Message-ID: Date: Fri, 17 Feb 2023 12:44:48 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.7.2 Subject: Re: [PATCH] app/testpmd: fix crash on cleanup Content-Language: en-US To: David Marchand , CC: , Yuying Zhang , Ferruh Yigit , Stephen Hemminger , Thomas Monjalon References: <20230206154946.750829-1-david.marchand@redhat.com> From: "Singh, Aman Deep" In-Reply-To: <20230206154946.750829-1-david.marchand@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PN2PR01CA0159.INDPRD01.PROD.OUTLOOK.COM (2603:1096:c01:26::14) To CY4PR11MB0054.namprd11.prod.outlook.com (2603:10b6:910:79::27) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CY4PR11MB0054:EE_|SJ2PR11MB7547:EE_ X-MS-Office365-Filtering-Correlation-Id: 63e1c12d-fffe-4b3e-6eb4-08db10b6aee0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6IGCYMzK9QJJhWW5nYnf0GKK2+z1wNmsipgD8FXi5Sd1Z9xNbqqdiKaTIwrtUr4HPw9tzBJ7W8Cf5cFRq1Bar20tMCQ+F1nnNTgzYuDhDv3Mr2Wm5Hv2im1ESRq1ByS/TB/yCJo/mAGMJhDJ+1mWhy7VaYkdCTQ30ism5ijsYllRyo/NG3RbJKvPTXiewlRdBj+PQ3cOnQ+k1VRC9J3b8M0Yc2CJ9D5V52N7tppCRj8KD0JOZSYdKMGkg7MoBSnrPBW9avvRVswbtpTj1PHKca26dRyoGZbzpDvwZNzZpTf4flAoy2moiszQUzxAlcf85Ev5RJUpF5IwH2uJc4+MD4olBTCau9IfYFTgK9Axul6MwyNjctBXUktuiVmNJlvElSV6q6KtgmJNZgihst5O9rfKWgv6GoNo7pHrGzvdLzu0QzCB2C4wiGxhPRFveWABZl8AHYh9cGRaDSjZ9dC86FQSBi1cEMHASmtMXiQHWyrSjPbrZbSOlPp3qQmyKkJgQuM3siphwDFs08J6l8ejlw2u8TXqXOqHpooH7i0AYxh4WoSwmylNPRagQPdMISpZqx8MYXqlx5ZQu4C5PAx2TQSgFg70Us9FjOUH63pZBaJm99Hkh9HbFgqPKq4WFEOTGmdU/KBRuFTRS3MZ7Uofsf58wOyosgTXFDUdoKI2COUlXwSf0MOMsZstInqvebqaHulSKJSvvSXgwdXMFrUGnRNN1xC6IODj3pORmbCipfE= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CY4PR11MB0054.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230025)(136003)(376002)(39860400002)(346002)(366004)(396003)(451199018)(66946007)(66476007)(8676002)(6666004)(83380400001)(31696002)(2616005)(86362001)(38100700002)(82960400001)(316002)(26005)(186003)(6512007)(478600001)(53546011)(6506007)(54906003)(36756003)(66556008)(2906002)(31686004)(8936002)(5660300002)(6486002)(41300700001)(4326008)(45980500001)(43740500002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L2ZHaWNqNC9JSmtpWktTcUxrejNlSzkrVVZDOG1uM0pER0tmekY1dzE2UCtr?= =?utf-8?B?SW50cHFmdGxUMkt0a0lhTmlTTjhTV2g2bWNmRXQ1RkFBRC9WRk54MHFCSk1Q?= =?utf-8?B?Z0VTS3NacDA3QVEwYi9YckVjUGpLeGJQakRCek9TT0FFTWNYazkybUVnN1U0?= =?utf-8?B?bGFlOFNqY2hUYnNlOWtXVHUrUVhLQzBScjBLaVpCNThOWXFodEs3QmNIK1Fa?= =?utf-8?B?K2dmdlJ5ZE1kUEFKWDBsWHdod0Zlb3EzT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?WUV2YWQ3RFpOanNrcC9SbEJyVUgySVNuL1Q5aTZnTkVGOXlKZW1pNGVyNVp5?= =?utf-8?B?T2x3U1JXK2c0ZzFhelBQWW15STl4dWNrb095QWtqaUJrWkJsSWY5L0pQd2JJ?= =?utf-8?B?ZWc9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: 63e1c12d-fffe-4b3e-6eb4-08db10b6aee0 X-MS-Exchange-CrossTenant-AuthSource: CY4PR11MB0054.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Feb 2023 07:15:00.8812 (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: RfDqqc1LrvFj4RRS9WnXOQdzUemYQYwRMFS+mZQQT2Kxg8HLpkeJHxr/gHhAyPzuyJE7Xm7xOmdGDnvsQKbZBU6J9EPmkyw59bIFJx8QAZA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR11MB7547 X-OriginatorOrg: intel.com 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 On 2/6/2023 9:19 PM, David Marchand wrote: > If allocating the ports[] array fails, a crash will occur when shutting > down testpmd since ethdev emits RTE_ETH_EVENT_DESTROY events. > Move init_port() before registering ethdev event handler. Looks ok to me. Avoids seg_fault, due to Null pointer access. > > Fixes: 85c6571c9103 ("app/testpmd: reset port status on close notification") > Cc: stable@dpdk.org > > Signed-off-by: David Marchand Acked-by: Aman Singh > --- > app/test-pmd/testpmd.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c > index e366f81a0f..de3017fd62 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -4385,6 +4385,9 @@ main(int argc, char** argv) > rte_exit(EXIT_FAILURE, "Cannot init EAL: %s\n", > rte_strerror(rte_errno)); > > + /* allocate port structures, and init them */ > + init_port(); > + > ret = register_eth_event_callback(); > if (ret != 0) > rte_exit(EXIT_FAILURE, "Cannot register for ethdev events"); > @@ -4403,9 +4406,6 @@ main(int argc, char** argv) > if (nb_ports == 0) > TESTPMD_LOG(WARNING, "No probed ethernet devices\n"); > > - /* allocate port structures, and init them */ > - init_port(); > - > set_def_fwd_config(); > if (nb_lcores == 0) > rte_exit(EXIT_FAILURE, "No cores defined for forwarding\n"