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 33EB843B78; Thu, 22 Feb 2024 16:58:18 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1052940281; Thu, 22 Feb 2024 16:58:18 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) by mails.dpdk.org (Postfix) with ESMTP id 621A14027F; Thu, 22 Feb 2024 16:58:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708617497; x=1740153497; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=0Hr1JVXFrhhObHjWWUXalXxaNbe51uSW6hTmhzYCMNE=; b=leHWuPzxUCXqGuTziGUyW1ANeYMV/9zQA41u7dOU6Qkz57bi1NSoRnEs 7pJtetojcUgfz5VRszckXaiqs59h4yE5GyjjYk72WlpeR/aT83jo/zCW/ /ZiU9SI74Ruqx9WoVegy+t0GbdmLdy1ke/qHsP+POxu3eQoCcFi1Vy+0s dfHd3dZH1i3d4LrB3+mevh4+XiB9k1LqIEXApRNxX9Y/urY8T09xHOSzw wSIEHagRRMOTTc2RgY4xcZCrdJrMjdc51/xfNCedXBzzL/UXQuTzYkIQc UZNYUYsRo8zETIC+ERc7ha0D69NwdtlBnQYHkF8ZTzXdK8zMOwN/gJnYS g==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="2722879" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="2722879" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 07:58:15 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="36541000" Received: from fmsmsx602.amr.corp.intel.com ([10.18.126.82]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 22 Feb 2024 07:58:14 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx602.amr.corp.intel.com (10.18.126.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Thu, 22 Feb 2024 07:58:14 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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.35 via Frontend Transport; Thu, 22 Feb 2024 07:58:14 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.100) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Thu, 22 Feb 2024 07:58:14 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AHs2Fm1owEZZkuPhHiaRHNujh0MoNSnCqvIr/yl3UkBPRJF+W5YKEylWI/9N+DmobhQEAOU3i6wgUqEN88cHgBxNZblr/INY/Ak5JVW/I63p+hGxT9E53IyqTcEr+96GLqVXHZkh9aZxHvtltD2wAwu7pjLRlvH6vaPe3J2CJ1bhkjiTCB4+qYIIaqOiyiSAoLiuyydC4zq8NCFf9BIZhNchAvVXMlDGRI2V+dDukS288Tsj+vsnHVwtIjS4gwpuOICQlvqNkhTvKoaHLK7vsoPqwgEVZOEJJYS9jVZ0ZBH3SKhcM6aIYCwTfAjL4TpNIbqL4ZY6nGfBOblGvmByBA== 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=0iAB9Bkz7HWEpyQrezZV+bSJ/k4y9UOJMVsypfNG1HE=; b=QXp9hDOw8XltPxqOrdgkAnS1G98eUK5qRAyOMIjX6X2LPA6pgOjlX0iNSh7HixYeKonwX4s7Ml1ToOko6nSXzE9hEg0Xok1J38Qj+tpV8JxKt6ELTUOBDydDuowQI0FughA+g1TQ4L0VW+Ty0b+kmrb48pPzPFHhxWFgpZvz+2jdjDyfzjBP2uezLezivCN6IT9X+PXinFuauRgUBVqoOkksKbyETK3HMSzsR8W3oPcHPSMx1Xt297oz5MjHKQsctxgypO6eDKxJlaxJ/dSrEJp8NuOJVrcMK4AzNo7furCMQrkqDhCUtPKvzJSDcBZptGecIEIdRTlt50HkoP+OVA== 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 Received: from MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by IA0PR11MB8417.namprd11.prod.outlook.com (2603:10b6:208:48d::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.39; Thu, 22 Feb 2024 15:58:12 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::92a7:f6a2:9262:d150]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::92a7:f6a2:9262:d150%3]) with mapi id 15.20.7316.018; Thu, 22 Feb 2024 15:58:12 +0000 From: "Loftus, Ciara" To: Yunjian Wang , "dev@dpdk.org" CC: "ferruh.yigit@amd.com" , "xudingke@huawei.com" , "stable@dpdk.org" Subject: RE: [PATCH v2] net/af_xdp: fix resources leak when xsk configure fails Thread-Topic: [PATCH v2] net/af_xdp: fix resources leak when xsk configure fails Thread-Index: AQHaZZQQgwUcb1byL02eybJm8ZZ8hLEWg9LA Date: Thu, 22 Feb 2024 15:58:12 +0000 Message-ID: References: <1708571262-48380-1-git-send-email-wangyunjian@huawei.com> <1708608939-14440-1-git-send-email-wangyunjian@huawei.com> In-Reply-To: <1708608939-14440-1-git-send-email-wangyunjian@huawei.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MW4PR11MB5872:EE_|IA0PR11MB8417:EE_ x-ms-office365-filtering-correlation-id: c05507fb-57d8-4d08-9fe2-08dc33bf1293 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IBENoF59+OsQCyz3gs4bn224fsDyEGTi7it5YyRn4qJG2/48SI4pmH+6Rx74AMhYQLlkcfKQq4Q+jJHl3dKCRIMVSC21P2732eGe/vv9rIArociI2OnKs3bhT0n0OxSeOz+BREHJEfOOis4Szu8qlj19bxMC7iwGCyBhWH4l0G4m6Ar97FdrhnRKthHpVQ4q5JXaPQiD6cuPuljY6UArKUPfijtsIwbEcPe++NCjRk3fZgZFzi4ECofpjg/KOT97eVCvsmAXva5Jkp2VXjglnsOTuquxy7HVwAm+UmzpcQjlmsMppUAVYR7+HgSO4qdShDGsSgck5ZbhgkOrwGviwlcGVfoDq7NKrNSGolJ2kcV5HHvLhtn4rJ6KKH91VnZUaHag55yfCgyqNAhq1+0uMg0Xzf8P6WgaMtFxyUoYHmBG8e/tGMJpwS5JGoL+xnoidjVf885kUBPv2otvHRhZL9RzQgSHcWsJKWI/PX1f5/NqJzOwHWVaByWgL7LkhIV0DRIiGBFLwG+1QjJk0QLf849Dq8k6o9wYcP2f09j32ECilvxy8enu0hm8iyeur6cx/IF/t+vnuTqmuliugXrCZeRQOtbEUcZmhLLldvqvdKFME8zcFzPlr/wpi2igf4kt x-forefront-antispam-report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MW4PR11MB5872.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(38070700009); DIR:OUT; SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?s5R86HYkmkJDtuvsVlWOrmiAccnpmb3PZwWP1NU1hE3lnNi3kGDA+yZjVDNT?= =?us-ascii?Q?ZiiQMO4ytxKRHUvn6SXl7ZnM7SwwODiMMUi9R8gh5KXDFQF1cDzj9TJu3b+i?= =?us-ascii?Q?ESLegyYGp2LTWPpFg2ASiqE+gSDhs9s5eMg7GWCQwz1GIUKE1SdBHsdS3PPa?= =?us-ascii?Q?OjDCYCjckrzBddApBjy0kHMktabMWwQi2aaoJZ0lmb/BsZnJpjRslqWmG/Yv?= =?us-ascii?Q?rT5/KGfs0jnNtPnPXDpn+T9KqcxgQNzeGUErxJyOz5i72uCMDKV/uhRZRiOh?= =?us-ascii?Q?TFeltE1ogIBna9V4GuswRYuNl73T162/2Ww5t1+azmB/X7/gOIsjHxojqdN6?= =?us-ascii?Q?f7IYnRrPbq2L83lpd0tNUwRydx1Gy0ka7U8RfxEdA40Dzuem5F/mD5pNW4Rt?= =?us-ascii?Q?kprNKdQyi45/fCDJTokx9WhKpC373z49xAqKcMbujeZhVBLEIqD+AASSFyLy?= =?us-ascii?Q?HiT4bLrzPufaeC68W9bFp7UzJggOh0V5SGfzlQk1ZcvvPjK4PbBSutgmtj9+?= =?us-ascii?Q?WBAexh+cc7epRTN9TvQP3iKFyIHX/8IFD3yXyKNIKSTRi+BqAt8A/u0RexZd?= =?us-ascii?Q?jHz/h4+hSVPjMA082wPNsMIsSyU5Qiematol5t8TxQmyzTAbwLRkAS+7QFVt?= =?us-ascii?Q?NrUbfnuVp/ZwfGc09WzHrJeh2292lmUOmICtWg0BrA14JIxo7X/JDte5jmfd?= =?us-ascii?Q?AZ9AU0SDot+5uVArJqWlkTxFoEvsiLIQqtkfazYcURw8eLoSB/mhS7ghlBME?= =?us-ascii?Q?Xz9xfNdopNz4qfbGnk90rPw/5D6ZqwmkpYt5jR+F4IgldKYQuYN2NgSTG63R?= =?us-ascii?Q?DUm4C8035sDMw6NITSI5J8vwJBhQBC1nUwaDPY/LctpiZvL6e3sdXkXanMR7?= =?us-ascii?Q?znobvaXceHSfSRJkhQvdWf6jaVX39O7Tg2Qm17i0CZAmvlFYFUMWifCc/ucG?= =?us-ascii?Q?TNZ0S50ARZnnBymptyZBMk9YVYpZbdSul32up5n4UbWtlyAa82O+MKHUQP95?= =?us-ascii?Q?BanaZ1vqJzGlbUes4sK2i1DXqsSHrtk8N86rAVQQfHdQeEUN76xwZuJQnmL7?= =?us-ascii?Q?75d+QT4/IU/pUuWv7iPw/sziq5MgxAIIRSnqHwp7/nHa6qbVS3KK66Ou287D?= =?us-ascii?Q?PEK6hG7fPFb3ySqgXBbVhcVCGIZrmILK36nERp+l7fhWiFhrh8y+E0uufOqu?= =?us-ascii?Q?xOUXYKnABESetnGh/Pa0cPh+BXtk4ptho0IYs6JJUoyeevIQhumuUIoieox9?= =?us-ascii?Q?I36V9qbcRIuynZgA1XA/WKRns7ymY88o+Q3ZIVIxMubLuEPJp50mEB64BHGC?= =?us-ascii?Q?xqLseeM5XQpFPqgL5ofOO5DYVsN+f5VLo/2pnEezpR3PwcKrKOOa7rs1bcws?= =?us-ascii?Q?aSTZmFR3FeqtiEZcuO16WLdcL1FBP24VvOzu6EGP+nP4+PsVdhPPChRIChop?= =?us-ascii?Q?ZN8xpakDLvgqLwXGxZ6oN0oN02HWdHqMiO6WXAdniUINqKLQECrLDkc7zsIf?= =?us-ascii?Q?y+CkJQBPZ8qpusr6WJtcI0lnlRrfBj0rLb0e8mru9B+YREzJIz4dKk8jwTYv?= =?us-ascii?Q?6HJ7xksvREot12LtVwh7sZgtUadrQLlYkPbdjYzN?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: c05507fb-57d8-4d08-9fe2-08dc33bf1293 X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Feb 2024 15:58:12.2794 (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: wWmJEqJlHPK2dYqLuDBcYWCi7SovkspQP80wfeqJNRmwGc5u+aMc4SId0P2dUdlArvzL4mWNfPgcWtiCeOj8xQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR11MB8417 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 > Subject: [PATCH v2] net/af_xdp: fix resources leak when xsk configure fai= ls >=20 > In xdp_umem_configure() allocated some resources for the > xsk umem, we should delete them when xsk configure fails, > otherwise it will lead to resources leak. >=20 > Fixes: f1debd77efaf ("net/af_xdp: introduce AF_XDP PMD") > Cc: stable@dpdk.org >=20 > Signed-off-by: Yunjian Wang Thanks! Reviewed-by > --- > v2: update code style as suggested by Maryam Tahhan > --- > drivers/net/af_xdp/rte_eth_af_xdp.c | 10 ++++++---- > 1 file changed, 6 insertions(+), 4 deletions(-) >=20 > diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c > b/drivers/net/af_xdp/rte_eth_af_xdp.c > index 2d151e45c7..b52513bd7e 100644 > --- a/drivers/net/af_xdp/rte_eth_af_xdp.c > +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c > @@ -960,6 +960,11 @@ remove_xdp_program(struct pmd_internals > *internals) > static void > xdp_umem_destroy(struct xsk_umem_info *umem) > { > + if (umem->umem) { > + (void)xsk_umem__delete(umem->umem); > + umem->umem =3D NULL; > + } > + > #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) > umem->mb_pool =3D NULL; > #else > @@ -992,11 +997,8 @@ eth_dev_close(struct rte_eth_dev *dev) > break; > xsk_socket__delete(rxq->xsk); >=20 > - if (__atomic_fetch_sub(&rxq->umem->refcnt, 1, > __ATOMIC_ACQUIRE) - 1 > - =3D=3D 0) { > - (void)xsk_umem__delete(rxq->umem->umem); > + if (__atomic_fetch_sub(&rxq->umem->refcnt, 1, > __ATOMIC_ACQUIRE) - 1 =3D=3D 0) > xdp_umem_destroy(rxq->umem); > - } >=20 > /* free pkt_tx_queue */ > rte_free(rxq->pair); > -- > 2.41.0