[PATCH] net: ixgbe: drop the SA reference if secpath_set() fails
From: Wentao Liang
Date: Tue Nov 03 2026 - 05:19:04 EST
ixgbe_ipsec_rx() takes a reference on the xfrm_state returned by
ixgbe_ipsec_find_rx_state(). On success that reference is handed over
to the skb's security path, which releases it when the skb is freed.
When secpath_set() cannot allocate the extension it returns NULL, but
the function returns without releasing the xfrm_state, so the SA
reference is leaked.
Put the reference before bailing out.
Fixes: 92103199f10a ("ixgbe: process the Rx ipsec offload")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
index bd397b3d7dea..e44d5eed9ab5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ipsec.c
@@ -1197,8 +1197,10 @@ void ixgbe_ipsec_rx(struct ixgbe_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++;
--
2.34.1