Within selinux we check for authorization before deleting entries from
SAD and SPD. 

We are not checking for authorization when flushing the SPD and
the SAD. It was perhaps missed in original patch.

This patch adds security check when flushing entries from SAD and SPD.

Please let me know if this patch is ok.
It was built against linux-2.6.21-rc4-git5. I have also tested it.

Joy

Signed-off-by: Joy Latten<[EMAIL PROTECTED]>


diff -urpN linux-2.6.20.orig/net/xfrm/xfrm_policy.c 
linux-2.6.20/net/xfrm/xfrm_policy.c
--- linux-2.6.20.orig/net/xfrm/xfrm_policy.c    2007-03-21 14:25:51.000000000 
-0500
+++ linux-2.6.20/net/xfrm/xfrm_policy.c 2007-03-21 14:30:59.000000000 -0500
@@ -829,6 +829,8 @@ void xfrm_policy_flush(u8 type, struct x
                                     &xfrm_policy_inexact[dir], bydst) {
                        if (pol->type != type)
                                continue;
+                       if (security_xfrm_policy_delete(pol))
+                               continue;
                        hlist_del(&pol->bydst);
                        hlist_del(&pol->byidx);
                        write_unlock_bh(&xfrm_policy_lock);
@@ -850,6 +852,8 @@ void xfrm_policy_flush(u8 type, struct x
                                             bydst) {
                                if (pol->type != type)
                                        continue;
+                               if (security_xfrm_policy_delete(pol))
+                                       continue;
                                hlist_del(&pol->bydst);
                                hlist_del(&pol->byidx);
                                write_unlock_bh(&xfrm_policy_lock);
diff -urpN linux-2.6.20.orig/net/xfrm/xfrm_state.c 
linux-2.6.20/net/xfrm/xfrm_state.c
--- linux-2.6.20.orig/net/xfrm/xfrm_state.c     2007-03-21 14:25:51.000000000 
-0500
+++ linux-2.6.20/net/xfrm/xfrm_state.c  2007-03-21 14:27:48.000000000 -0500
@@ -400,7 +400,8 @@ void xfrm_state_flush(u8 proto, struct x
 restart:
                hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) {
                        if (!xfrm_state_kern(x) &&
-                           xfrm_id_proto_match(x->id.proto, proto)) {
+                           xfrm_id_proto_match(x->id.proto, proto) &&
+                           !security_xfrm_state_delete(x)) {
                                xfrm_state_hold(x);
                                spin_unlock_bh(&xfrm_state_lock);
 
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to