kernel/relay.c: limit kmalloc size to KMALLOC_MAX_SIZE
[pandora-kernel.git] / kernel / audit_tree.c
index d52d247..8a14284 100644 (file)
@@ -154,6 +154,7 @@ static struct audit_chunk *alloc_chunk(int count)
                chunk->owners[i].index = i;
        }
        fsnotify_init_mark(&chunk->mark, audit_tree_destroy_watch);
+       chunk->mark.mask = FS_IN_IGNORED;
        return chunk;
 }
 
@@ -250,7 +251,6 @@ static void untag_chunk(struct node *p)
                spin_unlock(&hash_lock);
                spin_unlock(&entry->lock);
                fsnotify_destroy_mark(entry);
-               fsnotify_put_mark(entry);
                goto out;
        }
 
@@ -293,7 +293,6 @@ static void untag_chunk(struct node *p)
        spin_unlock(&hash_lock);
        spin_unlock(&entry->lock);
        fsnotify_destroy_mark(entry);
-       fsnotify_put_mark(entry);
        goto out;
 
 Fallback:
@@ -332,6 +331,7 @@ static int create_chunk(struct inode *inode, struct audit_tree *tree)
                spin_unlock(&hash_lock);
                chunk->dead = 1;
                spin_unlock(&entry->lock);
+               fsnotify_get_mark(entry);
                fsnotify_destroy_mark(entry);
                fsnotify_put_mark(entry);
                return 0;
@@ -412,6 +412,7 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
                spin_unlock(&chunk_entry->lock);
                spin_unlock(&old_entry->lock);
 
+               fsnotify_get_mark(chunk_entry);
                fsnotify_destroy_mark(chunk_entry);
 
                fsnotify_put_mark(chunk_entry);
@@ -445,7 +446,6 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree)
        spin_unlock(&old_entry->lock);
        fsnotify_destroy_mark(old_entry);
        fsnotify_put_mark(old_entry); /* pair to fsnotify_find mark_entry */
-       fsnotify_put_mark(old_entry); /* and kill it */
        return 0;
 }
 
@@ -609,9 +609,9 @@ void audit_trim_trees(void)
                }
                spin_unlock(&hash_lock);
                trim_marked(tree);
-               put_tree(tree);
                drop_collected_mounts(root_mnt);
 skip_it:
+               put_tree(tree);
                mutex_lock(&audit_filter_mutex);
        }
        list_del(&cursor);