From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18489FC591F for ; Thu, 26 Feb 2026 10:16:58 +0000 (UTC) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id EB20C40651; Thu, 26 Feb 2026 11:16:41 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id D1800400D6; Thu, 26 Feb 2026 03:39:51 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1202) id 5E30E20B6F02; Wed, 25 Feb 2026 18:39:51 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 5E30E20B6F02 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1772073591; bh=pWsXbVTlJz5mqogup15eV+I4niykGeZ4lgUKLaP+eDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=raaok6W4C0KuL1Mt2yOydmaNPtUZhuS3N2DJ6paKL3s/F22o6vPHdz5fBvmeWiQpv EYbnhBBME4n3wjncMf3YBourZRqmS+5pegUUT68oFmGSQ5tjBOzLuevtqrp313qbCa hYHbcZjXK5D7gZvccfqLVijgnq+ewKT0L0Uj22tY= From: longli@linux.microsoft.com To: dev@dpdk.org, Wei Hu , Stephen Hemminger , stable@dpdk.org, Dariusz Sosnowski , Viacheslav Ovsiienko , Bing Zhao , Ori Kam , Suanming Mou , Matan Azrad Cc: Long Li Subject: [PATCH v4 3/7] net/mana: fix PD resource leak on device close Date: Wed, 25 Feb 2026 18:39:34 -0800 Message-ID: <20260226023940.961844-4-longli@linux.microsoft.com> X-Mailer: git-send-email 2.43.7 In-Reply-To: <20260226023940.961844-1-longli@linux.microsoft.com> References: <20260226023940.961844-1-longli@linux.microsoft.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Thu, 26 Feb 2026 11:16:38 +0100 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 From: Long Li The Protection Domains (PDs) allocated during device initialization were not being deallocated on device close, causing a resource leak. Deallocate both ib_parent_pd and ib_pd in mana_dev_close() before closing the IB device context. Log errors if deallocation fails, which would indicate orphaned child resources (QPs, MRs). The close proceeds regardless because ibv_close_device() will force kernel cleanup of any remaining resources. Fixes: 2f5749ead13a ("net/mana: add basic driver with build environment") Cc: stable@dpdk.org Signed-off-by: Long Li --- drivers/net/mana/mana.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c index b7ae01b152..67396cda1f 100644 --- a/drivers/net/mana/mana.c +++ b/drivers/net/mana/mana.c @@ -282,6 +282,20 @@ mana_dev_close(struct rte_eth_dev *dev) if (ret) return ret; + if (priv->ib_parent_pd) { + int err = ibv_dealloc_pd(priv->ib_parent_pd); + if (err) + DRV_LOG(ERR, "Failed to deallocate parent PD: %d", err); + priv->ib_parent_pd = NULL; + } + + if (priv->ib_pd) { + int err = ibv_dealloc_pd(priv->ib_pd); + if (err) + DRV_LOG(ERR, "Failed to deallocate PD: %d", err); + priv->ib_pd = NULL; + } + ret = ibv_close_device(priv->ib_ctx); if (ret) { ret = errno; -- 2.43.0