lkml.org 
[lkml]   [2005]   [Jun]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 23/38] CKRM e18: Fix edge cases with empty lists and rule deletion
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 <matthltc@us.ibm.com>
Signed-Off-By: Gerrit Huizenga <gh@us.ibm.com>

Index: linux-2.6.12-ckrm1/kernel/ckrm/rbce/rbce_main.c
===================================================================
--- linux-2.6.12-ckrm1.orig/kernel/ckrm/rbce/rbce_main.c 2005-06-20 15:04:28.000000000 -0700
+++ linux-2.6.12-ckrm1/kernel/ckrm/rbce/rbce_main.c 2005-06-20 15:04:48.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);
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-06-23 09:23    [from the cache]
©2003-2011 Jasper Spaans