Skip to contentSkip to conversation

fixes for ixgbe/txgbe/iavf

PATCH Superseded Yunjian Wang 3 participants 13 messages Feb 15, 2022 – Feb 16, 2022 Network drivers

lore
Share & tools
lore
#0 lore raw

cover fixes for ixgbe/txgbe/iavf

This series include three fixes patches for ixgbe/txgbe/iavf.

Yunjian Wang (3):
net/ixgbe: set pointer to NULL after free
net/txgbe: set pointer to NULL after free
net/iavf: set pointer to NULL after free

 drivers/net/iavf/iavf_ipsec_crypto.c | 1 +
 drivers/net/ixgbe/ixgbe_ethdev.c     | 1 +
 drivers/net/txgbe/txgbe_ethdev.c     | 1 +
 3 files changed, 3 insertions(+)
Signature · 1 line
2.27.0
#1 lore raw

PATCH 1/3 net/ixgbe: set pointer to NULL after free

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")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
index 3d799d2187..7643842560 100644
@@ -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;
Signature · 1 line
2.27.0
Acked-by on v1 1/3
#2 lore raw

RE: [dpdk-dev] [PATCH 1/3] net/ixgbe: set pointer to NULL after free

Quoted 13 lines

-----Original Message-----
From: Yunjian Wang <[email protected]>
Sent: Tuesday, February 15, 2022 18:25
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Yunjian Wang <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH 1/3] net/ixgbe: set pointer to NULL after free

When ixgbe_dev_close() is cleaning up, it does not correctly set the security_ctx variable to NULL, which will lead to wild pointer.

Quoted 8 lines
Fixes 9a0752f498d2 ("net/ixgbe: enable inline IPsec")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 2 lines

--
2.27.0

#3 lore raw

PATCH 2/3 net/txgbe: set pointer to NULL after free

In reply to Yunjian Wang

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")
---
 drivers/net/txgbe/txgbe_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/txgbe/txgbe_ethdev.c +1 -0
index 7b42285b9e..19d4444748 100644
@@ -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;
Signature · 1 line
2.27.0
#4 lore raw

PATCH 3/3 net/iavf: set pointer to NULL after free

In reply to Yunjian Wang

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")
---
 drivers/net/iavf/iavf_ipsec_crypto.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/iavf/iavf_ipsec_crypto.c +1 -0
index 6ac1b213db..f13849ca1c 100644
@@ -1555,6 +1555,7 @@ iavf_security_ctx_destroy(struct iavf_adapter *adapter)
 
 	iavf_sctx = NULL;
 	sctx = NULL;
+	adapter->vf.eth_dev->security_ctx = NULL;
 
 	return 0;
 }
Signature · 1 line
2.27.0
#5 lore raw

RE: [dpdk-dev] [PATCH 3/3] net/iavf: set pointer to NULL after free

Quoted 26 lines

-----Original Message-----
From: Yunjian Wang <[email protected]>
Sent: Tuesday, February 15, 2022 18:25
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Yunjian Wang <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH 3/3] net/iavf: set pointer to NULL after free

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")
---
 drivers/net/iavf/iavf_ipsec_crypto.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/iavf/iavf_ipsec_crypto.c +0 -0
index 6ac1b213db..f13849ca1c 100644

drivers/net/iavf/iavf_ipsec_crypto.c iavf_security_ctx_destroy(struct iavf_adapter *adapter) · line 1557

Quoted 3 lines
drivers/net/iavf/iavf_ipsec_crypto.c +0 -0
@@ -1555,6 +1555,7 @@ iavf_security_ctx_destroy(struct iavf_adapter *adapter)
 
 	iavf_sctx = NULL;
 	sctx = NULL;

The above two lines can be removed, since it is local var.

drivers/net/iavf/iavf_ipsec_crypto.c iavf_security_ctx_destroy(struct iavf_adapter *adapter) · line 1558

Quoted 1 line
drivers/net/iavf/iavf_ipsec_crypto.c +1 -0
+	adapter->vf.eth_dev->security_ctx = NULL;

Also, adapter->security_ctx = NULL ?

Quoted 5 lines
drivers/net/iavf/iavf_ipsec_crypto.c +0 -1
 	return 0;
 }
--

2.27.0

#6 lore raw

RE: [dpdk-dev] [PATCH 3/3] net/iavf: set pointer to NULL after free

Quoted 42 lines

-----Original Message-----
From: Wang, Haiyue [mailto:[email protected]]
Sent: Tuesday, February 15, 2022 8:02 PM
To: wangyunjian <[email protected]>; [email protected]
Cc: Yigit, Ferruh <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; [email protected]; [email protected]; dingxiaoxiong <[email protected]>; Huangshaozhang <[email protected]>; [email protected]
Subject: RE: [dpdk-dev] [PATCH 3/3] net/iavf: set pointer to NULL after free

Quoted 32 lines

-----Original Message-----
From: Yunjian Wang <[email protected]>
Sent: Tuesday, February 15, 2022 18:25
To: [email protected]
Cc: Yigit, Ferruh <[email protected]>; Wu, Jingjing <[email protected]>; Xing, Beilei <[email protected]>; Wang, Haiyue <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; Yunjian Wang <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH 3/3] net/iavf: set pointer to NULL after free

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")
---
 drivers/net/iavf/iavf_ipsec_crypto.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/iavf/iavf_ipsec_crypto.c +0 -0
index 6ac1b213db..f13849ca1c 100644
@@ -1555,6 +1555,7 @@ iavf_security_ctx_destroy(struct iavf_adapter
 *adapter)
 
Quoted 4 lines

drivers/net/iavf/iavf_ipsec_crypto.c iavf_security_ctx_destroy(struct iavf_adapter *adapter) · line 1557

Quoted 2 lines
drivers/net/iavf/iavf_ipsec_crypto.c +0 -0
 	iavf_sctx = NULL;
 	sctx = NULL;

The above two lines can be removed, since it is local var.

Agree, I will remove them.

Quoted 4 lines

drivers/net/iavf/iavf_ipsec_crypto.c iavf_security_ctx_destroy(struct iavf_adapter *adapter) · line 1558

Quoted 2 lines
drivers/net/iavf/iavf_ipsec_crypto.c +1 -0
+	adapter->vf.eth_dev->security_ctx = NULL;

Also, adapter->security_ctx = NULL ?

OK, I will fix it in next version.

Quoted 6 lines
Quoted 6 lines
drivers/net/iavf/iavf_ipsec_crypto.c +0 -1
 	return 0;
 }
--

2.27.0

#7 lore raw

v2 cover fixes for ixgbe/txgbe/iavf

In reply to Yunjian Wang

This series include three fixes patches for ixgbe/txgbe/iavf.
---
v2:
* update patch 1/3 code styles suggested by Haiyue Wang

Yunjian Wang (3):
net/ixgbe: set pointer to NULL after free
net/txgbe: set pointer to NULL after free
net/iavf: set pointer to NULL after free

 drivers/net/iavf/iavf_ipsec_crypto.c | 4 ++--
 drivers/net/ixgbe/ixgbe_ethdev.c     | 1 +
 drivers/net/txgbe/txgbe_ethdev.c     | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)
Signature · 1 line
2.27.0
#8 lore raw

PATCH v2 1/3 net/ixgbe: set pointer to NULL after free

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")
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ixgbe/ixgbe_ethdev.c +1 -0
index 3d799d2187..7643842560 100644
@@ -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;
Signature · 1 line
2.27.0
#9 lore raw

PATCH v2 2/3 net/txgbe: set pointer to NULL after free

In reply to Yunjian Wang

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")
---
 drivers/net/txgbe/txgbe_ethdev.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/txgbe/txgbe_ethdev.c +1 -0
index 7b42285b9e..19d4444748 100644
@@ -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;
Signature · 1 line
2.27.0
#10 lore raw

PATCH v2 3/3 net/iavf: set pointer to NULL after free

In reply to Yunjian Wang

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")
---
 drivers/net/iavf/iavf_ipsec_crypto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/iavf/iavf_ipsec_crypto.c +2 -2
index 6ac1b213db..a63e42f29a 100644
@@ -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;
 }
Signature · 1 line
2.27.0
Reviewed-by on the v2 series
#11 lore raw
In reply to Yunjian Wang
Quoted 10 lines · Yunjian Wang

This series include three fixes patches for ixgbe/txgbe/iavf.
---
v2:
* update patch 1/3 code styles suggested by Haiyue Wang

Yunjian Wang (3):
net/ixgbe: set pointer to NULL after free
net/txgbe: set pointer to NULL after free
net/iavf: set pointer to NULL after free

For series,

#12 lore raw
Quoted 6 lines · Ferruh Yigit
Quoted 5 lines · Yunjian Wang

This series include three fixes patches for ixgbe/txgbe/iavf.
---
v2:
    * update patch 1/3 code styles suggested by Haiyue Wang

Quoted 8 lines
Quoted 5 lines

Yunjian Wang (3):
   net/ixgbe: set pointer to NULL after free
   net/txgbe: set pointer to NULL after free
   net/iavf: set pointer to NULL after free

For series,

Series applied to dpdk-next-net/main, thanks.