ixgbe_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: 92103199f10a3 ("ixgbe: process the Rx ipsec offload")
Cc: [email protected]
Signed-off-by: Wentao Liang <[email protected]>
---
 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

Reply via email to