[prev in list] [next in list] [prev in thread] [next in thread] 

List:       git-commits-head
Subject:    xfrm: do the garbage collection after flushing policy
From:       "Linux Kernel Mailing List" <linux-kernel () vger ! kernel ! org>
Date:       2017-04-28 21:15:20
Message-ID: 20170428211520.E25326611E5 () gitolite ! kernel ! org
[Download RAW message or body]

Web:        https://git.kernel.org/torvalds/c/35db0691218959f05efbe26fd623ee67581ebff6
Commit:     35db0691218959f05efbe26fd623ee67581ebff6
Parent:     fd2c83b35752f0a8236b976978ad4658df14a59f
Refname:    refs/heads/master
Author:     Xin Long <lucien.xin@gmail.com>
AuthorDate: Mon Apr 24 15:33:39 2017 +0800
Committer:  Steffen Klassert <steffen.klassert@secunet.com>
CommitDate: Wed Apr 26 10:34:32 2017 +0200

    xfrm: do the garbage collection after flushing policy
    
    Now xfrm garbage collection can be triggered by 'ip xfrm policy del'.
    These is no reason not to do it after flushing policies, especially
    considering that 'garbage collection deferred' is only triggered
    when it reaches gc_thresh.
    
    It's no good that the policy is gone but the xdst still hold there.
    The worse thing is that xdst->route/orig_dst is also hold and can
    not be released even if the orig_dst is already expired.
    
    This patch is to do the garbage collection if there is any policy
    removed in xfrm_policy_flush.
    
    Signed-off-by: Xin Long <lucien.xin@gmail.com>
    Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 net/xfrm/xfrm_policy.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 236cbbc0ab9c..dfc77b9c5e5a 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1006,6 +1006,10 @@ int xfrm_policy_flush(struct net *net, u8 type, bool task_valid)
 		err = -ESRCH;
 out:
 	spin_unlock_bh(&net->xfrm.xfrm_policy_lock);
+
+	if (cnt)
+		xfrm_garbage_collect(net);
+
 	return err;
 }
 EXPORT_SYMBOL(xfrm_policy_flush);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic