[patch 23/38] CKRM e18: Fix edge cases with empty lists and rule deletion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux