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 70022A0093 for ; Thu, 10 Mar 2022 11:07:36 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3DBA94113E; Thu, 10 Mar 2022 11:07:36 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id CF8AF4113E for ; Thu, 10 Mar 2022 11:07:33 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646906854; x=1678442854; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=bcu0YdQEUOfGDnpthPNmrY/kHxnALvZ9CvuasAP33g8=; b=bqR8YYihcrH8EEg2G3ISXDMsWoxJAVCtEf/CNL4QhEym64aqI+gBOtEN YwZy+vaZctpKMjHq6jWLs24PpvFLSt5MQEWsTus8QmxuJMXwIpF6KJ1D8 +x9o7kTw3TllumIUfjwNPuexsieGFs3nc/qdSgoXUMN45d6xJ/QiMHf6s QyBuadnCo33yWCSJv1BbQqF35tQT7v5Ftchb23KAFEIAxXxyL1TpNIDsw 9JE53mYLy42HCXu3OmWhPmm5GCJ/85lL55cq+1AJWtiz184zYjToTn6YY Fihrip+9gIZskKNZJdCYXJ+fHgw/au4HtjuZl7q+1o3qrdpTbwpDx04xP g==; X-IronPort-AV: E=McAfee;i="6200,9189,10281"; a="254041825" X-IronPort-AV: E=Sophos;i="5.90,170,1643702400"; d="scan'208";a="254041825" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Mar 2022 02:07:32 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.90,170,1643702400"; d="scan'208";a="688612937" Received: from silpixa00401086.ir.intel.com (HELO localhost.localdomain) ([10.55.128.118]) by fmsmga001.fm.intel.com with ESMTP; 10 Mar 2022 02:07:31 -0800 From: Ciara Loftus To: stable@dpdk.org Cc: Ciara Loftus Subject: [PATCH 19.11] net/af_xdp: ensure socket is deleted on Rx queue setup error Date: Thu, 10 Mar 2022 10:07:12 +0000 Message-Id: <20220310100712.19709-1-ciara.loftus@intel.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit 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 [ upstream commit b26431a617e4039e6c0f65c5ee56f62f347b686b ] During Rx queue setup the PMD attempts to allocate mbufs for the fill queue after the socket is created. If this allocation fails, the socket should be deleted before returning an error to the user. Fix this. Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks") Signed-off-by: Ciara Loftus --- drivers/net/af_xdp/rte_eth_af_xdp.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 9eae705caa..9b36d80335 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -898,26 +898,27 @@ xsk_configure(struct pmd_internals *internals, struct pkt_rx_queue *rxq, &txq->tx, &cfg); if (ret) { AF_XDP_LOG(ERR, "Failed to create xsk socket.\n"); - goto err; + goto out_umem; } #if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG) ret = rte_pktmbuf_alloc_bulk(rxq->umem->mb_pool, fq_bufs, reserve_size); if (ret) { AF_XDP_LOG(DEBUG, "Failed to get enough buffers for fq.\n"); - goto err; + goto out_xsk; } #endif ret = reserve_fill_queue(rxq->umem, reserve_size, fq_bufs); if (ret) { - xsk_socket__delete(rxq->xsk); AF_XDP_LOG(ERR, "Failed to reserve fill queue.\n"); - goto err; + goto out_xsk; } return 0; -err: +out_xsk: + xsk_socket__delete(rxq->xsk); +out_umem: xdp_umem_destroy(rxq->umem); return ret; -- 2.17.1