Skip to content

Commit

Permalink
in untag_chunk() we need to do alloc_chunk() a bit earlier
Browse files Browse the repository at this point in the history
... while we are not holding spinlocks.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Oct 30, 2010
1 parent b8800aa commit f7a998a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kernel/audit_tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ static void untag_chunk(struct node *p)
{
struct audit_chunk *chunk = find_chunk(p);
struct fsnotify_mark *entry = &chunk->mark;
struct audit_chunk *new;
struct audit_chunk *new = NULL;
struct audit_tree *owner;
int size = chunk->count - 1;
int i, j;
Expand All @@ -232,9 +232,14 @@ static void untag_chunk(struct node *p)

spin_unlock(&hash_lock);

if (size)
new = alloc_chunk(size);

spin_lock(&entry->lock);
if (chunk->dead || !entry->i.inode) {
spin_unlock(&entry->lock);
if (new)
free_chunk(new);
goto out;
}

Expand All @@ -255,9 +260,9 @@ static void untag_chunk(struct node *p)
goto out;
}

new = alloc_chunk(size);
if (!new)
goto Fallback;

fsnotify_duplicate_mark(&new->mark, entry);
if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.i.inode, NULL, 1)) {
free_chunk(new);
Expand Down

0 comments on commit f7a998a

Please sign in to comment.