[SRU][J:linux-bluefield][PATCH v1 3/9] xfrm: Flush xfrm state synchronously on netdev close or unregister

Tony Duan yifeid at nvidia.com
Mon Dec 25 06:20:25 UTC 2023


From: Jianbo Liu <jianbol at nvidia.com>

BugLink: https://bugs.launchpad.net/bugs/2044427

When NETDEV_DOWN or NETDEV_UNREGISTER is received, netdev is being
closed or unregistered, and all xfrm_states are being flushed.
It's better to bypass GC and destroy them directly, so the hardware
resources for those offloaded xfrm_state can be safely freed.

Fixes: d77e38e612a0 ("xfrm: Add an IPsec hardware offloading API")
Signed-off-by: Jianbo Liu <jianbol at nvidia.com>
Signed-off-by: Leon Romanovsky <leonro at nvidia.com>
(cherry picked from commit ebf036124a1df1eed16ab752212854495cbb8264)
Signed-off-by: Tony Duan <yifeid at nvidia.com>
---
 net/xfrm/xfrm_state.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index 05686ac..950761a 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -870,7 +870,7 @@ int xfrm_dev_state_flush(struct net *net, struct net_device *dev, bool task_vali
 				err = xfrm_state_delete(x);
 				xfrm_audit_state_delete(x, err ? 0 : 1,
 							task_valid);
-				xfrm_state_put(x);
+				xfrm_state_put_sync(x);
 				if (!err)
 					cnt++;
 
-- 
1.8.3.1




More information about the kernel-team mailing list