Fix rule re-insertion to be more careful with empty lists.
Fix rule deletion to not delete rules that are still in a list.

Signed-Off-By: Matt Helsley <[EMAIL PROTECTED]>
Signed-Off-By: Gerrit Huizenga <[EMAIL PROTECTED]>

Index: linux-2.6.13-ckrm1/kernel/ckrm/rbce/rbce_main.c
===================================================================
--- linux-2.6.13-ckrm1.orig/kernel/ckrm/rbce/rbce_main.c        2005-09-09 
17:40:30.000000000 -0700
+++ linux-2.6.13-ckrm1/kernel/ckrm/rbce/rbce_main.c     2005-09-09 
17:42:36.000000000 -0700
@@ -162,8 +162,8 @@ static int insert_rule(struct rbce_rule 
                        }
                }
        }
-       if (type == REINSERT)
-               list_del(&rule->obj.link);
+       if ((type == REINSERT) && !list_empty(&rule->obj.link))
+               list_del_init(&rule->obj.link);
        else {
                /*  protect the module from removed if a rule exists */
                try_module_get(THIS_MODULE);
@@ -340,12 +340,14 @@ static void __release_rule(struct rbce_r
 static inline int __delete_rule(struct rbce_rule *rule)
 {
        /* make sure we are not referenced by other rules */
+       if (list_empty(&rule->obj.link))
+               return 0;
        if (GET_REF(rule))
                return -EBUSY;
        __release_rule(rule);
        put_class(rule->target_class);
        release_term_index(rule->index);
-       list_del(&rule->obj.link);
+       list_del_init(&rule->obj.link);
        gl_num_rules--;
        gl_rules_version++;
        module_put(THIS_MODULE);

--


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
ckrm-tech mailing list
https://lists.sourceforge.net/lists/listinfo/ckrm-tech

Reply via email to