patches for DPDK stable branches
 help / color / mirror / Atom feed
* [PATCH 1/1] net/iavf: fix memoy leak in error path
@ 2023-12-01 10:46 Yunjian Wang
  2023-12-14  1:45 ` [PATCH RESEND] " Yunjian Wang
  2023-12-14  4:39 ` Zhang, Qi Z
  0 siblings, 2 replies; 3+ messages in thread
From: Yunjian Wang @ 2023-12-01 10:46 UTC (permalink / raw)
  To: dev
  Cc: jingjing.wu, beilei.xing, xudingke, jerry.lilijun, Yunjian Wang, stable

In iavf_security_ctx_create() allocated memory for the
'security_ctx', we should free it when memory malloc for
the 'iavf_security_ctx' fails, otherwise it will lead to
memory leak.

Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
Cc: stable@dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
---
 drivers/net/iavf/iavf_ipsec_crypto.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c
index 07a69db540..d6c0180ffd 100644
--- a/drivers/net/iavf/iavf_ipsec_crypto.c
+++ b/drivers/net/iavf/iavf_ipsec_crypto.c
@@ -1518,8 +1518,11 @@ iavf_security_ctx_create(struct iavf_adapter *adapter)
 	if (adapter->security_ctx == NULL) {
 		adapter->security_ctx = rte_malloc("iavf_security_ctx",
 				sizeof(struct iavf_security_ctx), 0);
-		if (adapter->security_ctx == NULL)
+		if (adapter->security_ctx == NULL) {
+			rte_free(adapter->vf.eth_dev->security_ctx);
+			adapter->vf.eth_dev->security_ctx = NULL;
 			return -ENOMEM;
+		}
 	}
 
 	return 0;
-- 
2.33.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-14  4:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 10:46 [PATCH 1/1] net/iavf: fix memoy leak in error path Yunjian Wang
2023-12-14  1:45 ` [PATCH RESEND] " Yunjian Wang
2023-12-14  4:39 ` Zhang, Qi Z

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).