From patchwork Tue Feb 15 13:01:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunjian Wang X-Patchwork-Id: 107641 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 4626FA00C5; Tue, 15 Feb 2022 14:01:57 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3690441151; Tue, 15 Feb 2022 14:01:56 +0100 (CET) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by mails.dpdk.org (Postfix) with ESMTP id 8A1C0410F7; Tue, 15 Feb 2022 14:01:54 +0100 (CET) Received: from dggpemm500021.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Jyh666cg7zYdNh; Tue, 15 Feb 2022 21:00:46 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggpemm500021.china.huawei.com (7.185.36.109) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 15 Feb 2022 21:01:52 +0800 Received: from localhost (10.174.242.157) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 15 Feb 2022 21:01:52 +0800 From: Yunjian Wang To: CC: , , , , , , , , Yunjian Wang , Subject: [dpdk-dev] [PATCH v2 1/3] net/ixgbe: set pointer to NULL after free Date: Tue, 15 Feb 2022 21:01:51 +0800 Message-ID: <652bd4da8f728423eca3554b13f26e5838b96d6b.1644927269.git.wangyunjian@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.174.242.157] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected 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 When ixgbe_dev_close() is cleaning up, it does not correctly set the security_ctx variable to NULL, which will lead to wild pointer. Fixes: 9a0752f498d2 ("net/ixgbe: enable inline IPsec") Cc: stable@dpdk.org Acked-by: Haiyue Wang Signed-off-by: Yunjian Wang --- drivers/net/ixgbe/ixgbe_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 3d799d2187..7643842560 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -3038,6 +3038,7 @@ ixgbe_dev_close(struct rte_eth_dev *dev) #ifdef RTE_LIB_SECURITY rte_free(dev->security_ctx); + dev->security_ctx = NULL; #endif return ret; From patchwork Tue Feb 15 13:02:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunjian Wang X-Patchwork-Id: 107642 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 774E9A00C5; Tue, 15 Feb 2022 14:02:20 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 641464113E; Tue, 15 Feb 2022 14:02:20 +0100 (CET) Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by mails.dpdk.org (Postfix) with ESMTP id 2AAD741147; Tue, 15 Feb 2022 14:02:19 +0100 (CET) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4Jyh2r6HQYzZfFg; Tue, 15 Feb 2022 20:57:56 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 15 Feb 2022 21:02:17 +0800 Received: from localhost (10.174.242.157) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 15 Feb 2022 21:02:17 +0800 From: Yunjian Wang To: CC: , , , , , , , , Yunjian Wang , Subject: [dpdk-dev] [PATCH v2 2/3] net/txgbe: set pointer to NULL after free Date: Tue, 15 Feb 2022 21:02:01 +0800 Message-ID: X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.174.242.157] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected 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 When txgbe_dev_close() is cleaning up, it does not correctly set the security_ctx variable to NULL, which will lead to wild pointer. Fixes: f437d97c3df1 ("net/txgbe: add IPsec context creation") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/net/txgbe/txgbe_ethdev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c index 7b42285b9e..19d4444748 100644 --- a/drivers/net/txgbe/txgbe_ethdev.c +++ b/drivers/net/txgbe/txgbe_ethdev.c @@ -2032,6 +2032,7 @@ txgbe_dev_close(struct rte_eth_dev *dev) #ifdef RTE_LIB_SECURITY rte_free(dev->security_ctx); + dev->security_ctx = NULL; #endif return ret; From patchwork Tue Feb 15 13:02:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yunjian Wang X-Patchwork-Id: 107643 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 7A17CA00C5; Tue, 15 Feb 2022 14:02:31 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6E2D64117A; Tue, 15 Feb 2022 14:02:31 +0100 (CET) Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by mails.dpdk.org (Postfix) with ESMTP id 9848E4113F; Tue, 15 Feb 2022 14:02:29 +0100 (CET) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.56]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4Jyh3341kKz1FD3Z; Tue, 15 Feb 2022 20:58:07 +0800 (CST) Received: from dggpemm500008.china.huawei.com (7.185.36.136) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 15 Feb 2022 21:02:28 +0800 Received: from localhost (10.174.242.157) by dggpemm500008.china.huawei.com (7.185.36.136) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.21; Tue, 15 Feb 2022 21:02:27 +0800 From: Yunjian Wang To: CC: , , , , , , , , Yunjian Wang , Subject: [dpdk-dev] [PATCH v2 3/3] net/iavf: set pointer to NULL after free Date: Tue, 15 Feb 2022 21:02:27 +0800 Message-ID: X-Mailer: git-send-email 1.9.5.msysgit.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.174.242.157] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500008.china.huawei.com (7.185.36.136) X-CFilter-Loop: Reflected 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 When iavf_security_ctx_destroy() is cleaning up, it does not correctly set the security_ctx variable to NULL, which will lead to wild pointer. Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto") Cc: stable@dpdk.org Signed-off-by: Yunjian Wang --- drivers/net/iavf/iavf_ipsec_crypto.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c index 6ac1b213db..a63e42f29a 100644 --- a/drivers/net/iavf/iavf_ipsec_crypto.c +++ b/drivers/net/iavf/iavf_ipsec_crypto.c @@ -1553,8 +1553,8 @@ iavf_security_ctx_destroy(struct iavf_adapter *adapter) rte_free(iavf_sctx); rte_free(sctx); - iavf_sctx = NULL; - sctx = NULL; + adapter->security_ctx = NULL; + adapter->vf.eth_dev->security_ctx = NULL; return 0; }