Skip to content

Commit f7a998a

Browse files
author
Al Viro
committed
in untag_chunk() we need to do alloc_chunk() a bit earlier
... while we are not holding spinlocks. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent b8800aa commit f7a998a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎kernel/audit_tree.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ static void untag_chunk(struct node *p)
223223
{
224224
struct audit_chunk *chunk = find_chunk(p);
225225
struct fsnotify_mark *entry = &chunk->mark;
226-
struct audit_chunk *new;
226+
struct audit_chunk *new = NULL;
227227
struct audit_tree *owner;
228228
int size = chunk->count - 1;
229229
int i, j;
@@ -232,9 +232,14 @@ static void untag_chunk(struct node *p)
232232

233233
spin_unlock(&hash_lock);
234234

235+
if (size)
236+
new = alloc_chunk(size);
237+
235238
spin_lock(&entry->lock);
236239
if (chunk->dead || !entry->i.inode) {
237240
spin_unlock(&entry->lock);
241+
if (new)
242+
free_chunk(new);
238243
goto out;
239244
}
240245

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

258-
new = alloc_chunk(size);
259263
if (!new)
260264
goto Fallback;
265+
261266
fsnotify_duplicate_mark(&new->mark, entry);
262267
if (fsnotify_add_mark(&new->mark, new->mark.group, new->mark.i.inode, NULL, 1)) {
263268
free_chunk(new);

0 commit comments

Comments
 (0)