Skip to contentSkip to conversation

ixgbevf: fix xfrm_state reference leak in ixgbevf_ipsec_rx()

PATCH In review Wentao Liang 5 participants 7 messages Sep 17 – Oct 6

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ixgbevf: fix xfrm_state reference leak in ixgbevf_ipsec_rx()

ixgbevf_ipsec_find_rx_state() returns the state with an extra reference, which is handed over to the secpath on the success path. When secpath_set() fails, the state has not been stored anywhere yet and the reference is dropped on the floor.

Release it before returning.

Fixes 0062e7cc955e0 ("ixgbevf: add VF IPsec offload code")
---
 drivers/net/ethernet/intel/ixgbevf/ipsec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbevf/ipsec.c +3 -1
index 076fd0a24858..bf3fcab3bd57 100644
@@ -596,8 +596,10 @@ void ixgbevf_ipsec_rx(struct ixgbevf_ring *rx_ring,
 		return;
 
 	sp = secpath_set(skb);
-	if (unlikely(!sp))
+	if (unlikely(!sp)) {
+		xfrm_state_put(xs);
 		return;
+	}
 
 	sp->xvec[sp->len++] = xs;
 	sp->olen++;
Signature · 1 line
2.34.1
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Wentao Liang

ixgbevf_ipsec_find_rx_state() returns the state with an extra reference, which is handed over to the secpath on the success path. When secpath_set() fails, the state has not been stored anywhere yet and the reference is dropped on the floor.

Release it before returning.

Fixes 0062e7cc955e0 ("ixgbevf: add VF IPsec offload code")
#2 lore raw
Quoted 18 lines

-----Original Message-----
From: Simon Horman <[email protected]>
Sent: Monday, September 21, 2026 12:35 PM
To: Wentao Liang <[email protected]>
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] ixgbevf: fix xfrm_state reference leak in ixgbevf_ipsec_rx()

Quoted 6 lines · Wentao Liang

ixgbevf_ipsec_find_rx_state() returns the state with an extra reference, which is handed over to the secpath on the success path. When
secpath_set() fails, the state has not been stored anywhere yet and the reference is dropped on the floor.

Quoted 7 lines
Quoted 5 lines

Release it before returning.

Fixes 0062e7cc955e0 ("ixgbevf: add VF IPsec offload code")
Reviewed-by on v1 1/1
#3 lore raw
In reply to Wentao Liang
Quoted 47 lines

-----Original Message-----
From: Wentao Liang <[email protected]>
Sent: Thursday, September 17, 2026 1:14 PM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; intel-wired- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; Wentao Liang <[email protected]>; [email protected]
Subject: [PATCH] ixgbevf: fix xfrm_state reference leak in ixgbevf_ipsec_rx()

ixgbevf_ipsec_find_rx_state() returns the state with an extra reference, which is handed over to the secpath on the success path. When
secpath_set() fails, the state has not been stored anywhere yet and the reference is dropped on the floor.

Release it before returning.

Fixes 0062e7cc955e0 ("ixgbevf: add VF IPsec offload code")
---
 drivers/net/ethernet/intel/ixgbevf/ipsec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbevf/ipsec.c +3 -1
index 076fd0a24858..bf3fcab3bd57 100644
@@ -596,8 +596,10 @@ void ixgbevf_ipsec_rx(struct ixgbevf_ring
 *rx_ring,
 		return;
 
 	sp = secpath_set(skb);
-	if (unlikely(!sp))
+	if (unlikely(!sp)) {
+		xfrm_state_put(xs);
 		return;
+	}
 
 	sp->xvec[sp->len++] = xs;
Quoted 3 lines

sp->olen++;
--
2.34.1

#4 lore raw
Quoted 57 lines

-----Original Message-----
From: Loktionov, Aleksandr <[email protected]>
Sent: Monday, September 21, 2026 5:30 PM
To: Wentao Liang <[email protected]>; [email protected]
Cc: Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]
Subject: RE: [PATCH] ixgbevf: fix xfrm_state reference leak in ixgbevf_ipsec_rx()

Quoted 44 lines

-----Original Message-----
From: Wentao Liang <[email protected]>
Sent: Thursday, September 17, 2026 1:14 PM
To: [email protected]
Cc: Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; intel-wired- [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; Wentao Liang <[email protected]>; [email protected]
Subject: [PATCH] ixgbevf: fix xfrm_state reference leak in ixgbevf_ipsec_rx()

ixgbevf_ipsec_find_rx_state() returns the state with an extra reference, which is handed over to the secpath on the success path. When
secpath_set() fails, the state has not been stored anywhere yet and the reference is dropped on the floor.

Release it before returning.

Fixes 0062e7cc955e0 ("ixgbevf: add VF IPsec offload code")
---
 drivers/net/ethernet/intel/ixgbevf/ipsec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/ixgbevf/ipsec.c +3 -1
index 076fd0a24858..bf3fcab3bd57 100644
@@ -596,8 +596,10 @@ void ixgbevf_ipsec_rx(struct ixgbevf_ring
 *rx_ring,
 		return;
 
 	sp = secpath_set(skb);
-	if (unlikely(!sp))
+	if (unlikely(!sp)) {
+		xfrm_state_put(xs);
 		return;
+	}
 
Quoted 6 lines
Quoted 4 lines
drivers/net/ethernet/intel/ixgbevf/ipsec.c +0 -0
 	sp->xvec[sp->len++] = xs;

sp->olen++;
--
2.34.1

Reviewed-by on v1 1/1
#5 lore raw
In reply to Wentao Liang
Quoted 5 lines · Wentao Liang

ixgbevf_ipsec_find_rx_state() returns the state with an extra reference, which is handed over to the secpath on the success path. When secpath_set() fails, the state has not been stored anywhere yet and the reference is dropped on the floor.

Quoted 9 lines

Release it before returning.

Fixes 0062e7cc955e0 ("ixgbevf: add VF IPsec offload code")
---
 drivers/net/ethernet/intel/ixgbevf/ipsec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
#6 lore raw
Quoted 28 lines

-----Original Message-----
From: Joe Damato <[email protected]>
Sent: Wednesday, September 30, 2026 2:48 AM
To: Wentao Liang <[email protected]>
Cc: [email protected]; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Kitszel, Przemyslaw <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH] ixgbevf: fix xfrm_state reference leak in ixgbevf_ipsec_rx()

Quoted 6 lines · Wentao Liang

ixgbevf_ipsec_find_rx_state() returns the state with an extra reference, which is handed over to the secpath on the success path. When
secpath_set() fails, the state has not been stored anywhere yet and the reference is dropped on the floor.

Quoted 9 lines

Release it before returning.

Fixes 0062e7cc955e0 ("ixgbevf: add VF IPsec offload code")
---
 drivers/net/ethernet/intel/ixgbevf/ipsec.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 1 line