bonding: process the err returned by dev_set_allmulti properly in bond_enslave
[pandora-kernel.git] / kernel / audit_watch.c
index e683869..4b4b9d5 100644 (file)
@@ -471,13 +471,15 @@ void audit_remove_watch_rule(struct audit_krule *krule)
        list_del(&krule->rlist);
 
        if (list_empty(&watch->rules)) {
+               /*
+                * audit_remove_watch() drops our reference to 'parent' which
+                * can get freed. Grab our own reference to be safe.
+                */
+               audit_get_parent(parent);
                audit_remove_watch(watch);
-
-               if (list_empty(&parent->watches)) {
-                       audit_get_parent(parent);
+               if (list_empty(&parent->watches))
                        fsnotify_destroy_mark(&parent->mark);
-                       audit_put_parent(parent);
-               }
+               audit_put_parent(parent);
        }
 }