提交 7c2776ee 编写于 作者: A Alexey Dobriyan 提交者: David S. Miller

netns xfrm: flush SA/SPDs on netns stop

SA/SPD doesn't pin netns (and it shouldn't), so get rid of them by hand.
Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 fbda33b2
...@@ -2441,9 +2441,23 @@ static int __net_init xfrm_policy_init(struct net *net) ...@@ -2441,9 +2441,23 @@ static int __net_init xfrm_policy_init(struct net *net)
static void xfrm_policy_fini(struct net *net) static void xfrm_policy_fini(struct net *net)
{ {
struct xfrm_audit audit_info;
unsigned int sz; unsigned int sz;
int dir; int dir;
flush_work(&net->xfrm.policy_hash_work);
#ifdef CONFIG_XFRM_SUB_POLICY
audit_info.loginuid = -1;
audit_info.sessionid = -1;
audit_info.secid = 0;
xfrm_policy_flush(net, XFRM_POLICY_TYPE_SUB, &audit_info);
#endif
audit_info.loginuid = -1;
audit_info.sessionid = -1;
audit_info.secid = 0;
xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, &audit_info);
flush_work(&xfrm_policy_gc_work);
WARN_ON(!list_empty(&net->xfrm.policy_all)); WARN_ON(!list_empty(&net->xfrm.policy_all));
for (dir = 0; dir < XFRM_POLICY_MAX * 2; dir++) { for (dir = 0; dir < XFRM_POLICY_MAX * 2; dir++) {
......
...@@ -2114,8 +2114,16 @@ int __net_init xfrm_state_init(struct net *net) ...@@ -2114,8 +2114,16 @@ int __net_init xfrm_state_init(struct net *net)
void xfrm_state_fini(struct net *net) void xfrm_state_fini(struct net *net)
{ {
struct xfrm_audit audit_info;
unsigned int sz; unsigned int sz;
flush_work(&net->xfrm.state_hash_work);
audit_info.loginuid = -1;
audit_info.sessionid = -1;
audit_info.secid = 0;
xfrm_state_flush(net, IPSEC_PROTO_ANY, &audit_info);
flush_work(&net->xfrm.state_gc_work);
WARN_ON(!list_empty(&net->xfrm.state_all)); WARN_ON(!list_empty(&net->xfrm.state_all));
sz = (net->xfrm.state_hmask + 1) * sizeof(struct hlist_head); sz = (net->xfrm.state_hmask + 1) * sizeof(struct hlist_head);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册