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 7413943C60 for ; Thu, 7 Mar 2024 02:32:50 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 694E742ECF; Thu, 7 Mar 2024 02:32:50 +0100 (CET) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mails.dpdk.org (Postfix) with ESMTP id 36EFD42EC6 for ; Thu, 7 Mar 2024 02:32:49 +0100 (CET) Received: by mail-wr1-f41.google.com with SMTP id ffacd0b85a97d-33d568fbf62so131530f8f.3 for ; Wed, 06 Mar 2024 17:32:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1709775169; x=1710379969; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U6Etr9T99Xsu3MwLEVB58uE0AmTr7XV+9hh5SSE1XP8=; b=mqMaBIey83hxe3f1e7kDGWriST2GsHutwcZEowLB0+na/WV4v83c96Tr5z25BXWLj8 dfCznZXnqqseG7uCkOzKOfb8s9Es8yzuf9V443Fbq2vA2QKJdaxPyR1nU9SbqHUJsPbi eTBUjeToRK1vCje7CE3ekievsyH1PvRmO7ymhfH/8tA36x4aC86p9kiXUYqMEEXHavm8 UcLfCTXoJ8CSfdF+8XaR/13sOdcMhyZXafqhQHgkwWuibSp65oGKteYrVpJYmQ5AZ+lw rVpq/EGsJGqNSD573g7cwjw1s0ZQT5pfrdC8Tkk2CCwzFDCcprUx2w2jFPPuPPTefD8G dpkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709775169; x=1710379969; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U6Etr9T99Xsu3MwLEVB58uE0AmTr7XV+9hh5SSE1XP8=; b=jlEsdtY7JZU63FaRpcNcf+3oDbwSpQM6jCumc8h18sfbc8NHyP+WRYEj5CZRGBsag2 X9+Qr/xmUxC0A8znaLdGOklqiOqll8bWsHXXDCBB3DVn4sMitwYaZnsfjav617+TCsNt Jrd/AdlKgi6GtyAQX3Yi4WPuk0j5mYrq1n+odeZ5tBZ/GyIxny1XTYa+XHkJSeK4jL2d Ih30zqzOBw9ARS6qE3BgKIBw0J4z95sDYFFlfW/1RzruagVHYcUls/0m5+QHQ6PzYN7T kDKjqILp33h0S38zRmpoBB6sfpv9pwRi8z3RwC62fRxhws4i9y0aX6OZVUfDucxJxQ6b 02Pw== X-Forwarded-Encrypted: i=1; AJvYcCVoFF7bOqnzy6A93xQH8AAIoX6d7tGgGfFGQ1L9M1Kgo6aEeDWwnmpPOR7XExCNAlR9pAmPiXTTio6oMvAfBtc= X-Gm-Message-State: AOJu0Yw1JG2KKWYTGSkhL1fx37dbSa7ugCE8IxR946B0jWQOfR8r448n rfB4HCjXCk/pRpe3hdKAD2ktAstlYKxnsIDBfk4ftmD5eULFBETMR7KQ+2vH X-Google-Smtp-Source: AGHT+IErD23mmcxVuR0yCoApbmHGMZVG2GAtkG4iLOMmUAu5nydmD9/e9W7zJ2e/v2a2CboumksXQg== X-Received: by 2002:a05:6000:505:b0:33d:2eba:f5cb with SMTP id a5-20020a056000050500b0033d2ebaf5cbmr11788896wrf.24.1709775168797; Wed, 06 Mar 2024 17:32:48 -0800 (PST) Received: from localhost ([137.220.120.171]) by smtp.gmail.com with ESMTPSA id g1-20020adfd1e1000000b0033e3a24f17esm10378012wrd.76.2024.03.06.17.32.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 17:32:48 -0800 (PST) From: luca.boccassi@gmail.com To: Yunjian Wang Cc: Qi Zhang , dpdk stable Subject: patch 'net/ixgbe: fix memoy leak after device init failure' has been queued to stable release 22.11.5 Date: Thu, 7 Mar 2024 01:30:27 +0000 Message-Id: <20240307013159.1735343-10-luca.boccassi@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240307013159.1735343-1-luca.boccassi@gmail.com> References: <20240307013159.1735343-1-luca.boccassi@gmail.com> MIME-Version: 1.0 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 Hi, FYI, your patch has been queued to stable release 22.11.5 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 03/09/24. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/bluca/dpdk-stable This queued commit can be viewed at: https://github.com/bluca/dpdk-stable/commit/6bc4e06ef94ee8fdec3734574c026b6b9703cbfc Thanks. Luca Boccassi --- >From 6bc4e06ef94ee8fdec3734574c026b6b9703cbfc Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Thu, 14 Dec 2023 14:44:41 +0800 Subject: [PATCH] net/ixgbe: fix memoy leak after device init failure [ upstream commit 4d70ae0f1bb88e2aa100f5f7bf50b6484f0685cd ] In ixgbe_ipsec_ctx_create() allocated memory for the 'security_ctx', we should free it when errors occur, otherwise it will lead to memory leak. Fixes: 9a0752f498d2 ("net/ixgbe: enable inline IPsec") Signed-off-by: Yunjian Wang Acked-by: Qi Zhang --- drivers/net/ixgbe/ixgbe_ethdev.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 65655b9212..9c0e0efb66 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -1187,7 +1187,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) diag = ixgbe_validate_eeprom_checksum(hw, &csum); if (diag != IXGBE_SUCCESS) { PMD_INIT_LOG(ERR, "The EEPROM checksum is not valid: %d", diag); - return -EIO; + ret = -EIO; + goto err_exit; } #ifdef RTE_LIBRTE_IXGBE_BYPASS @@ -1225,7 +1226,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) PMD_INIT_LOG(ERR, "Unsupported SFP+ Module"); if (diag) { PMD_INIT_LOG(ERR, "Hardware Initialization Failure: %d", diag); - return -EIO; + ret = -EIO; + goto err_exit; } /* Reset the hw statistics */ @@ -1245,7 +1247,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) "Failed to allocate %u bytes needed to store " "MAC addresses", RTE_ETHER_ADDR_LEN * hw->mac.num_rar_entries); - return -ENOMEM; + ret = -ENOMEM; + goto err_exit; } /* Copy the permanent MAC address */ rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.perm_addr, @@ -1260,7 +1263,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) RTE_ETHER_ADDR_LEN * IXGBE_VMDQ_NUM_UC_MAC); rte_free(eth_dev->data->mac_addrs); eth_dev->data->mac_addrs = NULL; - return -ENOMEM; + ret = -ENOMEM; + goto err_exit; } /* initialize the vfta */ @@ -1344,6 +1348,11 @@ err_pf_host_init: eth_dev->data->mac_addrs = NULL; rte_free(eth_dev->data->hash_mac_addrs); eth_dev->data->hash_mac_addrs = NULL; +err_exit: +#ifdef RTE_LIB_SECURITY + rte_free(eth_dev->security_ctx); + eth_dev->security_ctx = NULL; +#endif return ret; } -- 2.39.2 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2024-03-07 01:05:35.957057485 +0000 +++ 0010-net-ixgbe-fix-memoy-leak-after-device-init-failure.patch 2024-03-07 01:05:34.654936961 +0000 @@ -1 +1 @@ -From 4d70ae0f1bb88e2aa100f5f7bf50b6484f0685cd Mon Sep 17 00:00:00 2001 +From 6bc4e06ef94ee8fdec3734574c026b6b9703cbfc Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 4d70ae0f1bb88e2aa100f5f7bf50b6484f0685cd ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index d6cf00317e..a32d3a6d7c 100644 +index 65655b9212..9c0e0efb66 100644 @@ -23 +24 @@ -@@ -1190,7 +1190,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -1187,7 +1187,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -33 +34 @@ -@@ -1228,7 +1229,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -1225,7 +1226,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -43 +44 @@ -@@ -1248,7 +1250,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -1245,7 +1247,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -53 +54 @@ -@@ -1263,7 +1266,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) +@@ -1260,7 +1263,8 @@ eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_params __rte_unused) @@ -63 +64 @@ -@@ -1347,6 +1351,11 @@ err_pf_host_init: +@@ -1344,6 +1348,11 @@ err_pf_host_init: