diff options
| -rw-r--r-- | kernel/audit_tree.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c index b36aa9651ba2..4b05bd9479db 100644 --- a/kernel/audit_tree.c +++ b/kernel/audit_tree.c | |||
| @@ -373,15 +373,17 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
| 373 | for (n = 0; n < old->count; n++) { | 373 | for (n = 0; n < old->count; n++) { |
| 374 | if (old->owners[n].owner == tree) { | 374 | if (old->owners[n].owner == tree) { |
| 375 | spin_unlock(&hash_lock); | 375 | spin_unlock(&hash_lock); |
| 376 | put_inotify_watch(watch); | 376 | put_inotify_watch(&old->watch); |
| 377 | return 0; | 377 | return 0; |
| 378 | } | 378 | } |
| 379 | } | 379 | } |
| 380 | spin_unlock(&hash_lock); | 380 | spin_unlock(&hash_lock); |
| 381 | 381 | ||
| 382 | chunk = alloc_chunk(old->count + 1); | 382 | chunk = alloc_chunk(old->count + 1); |
| 383 | if (!chunk) | 383 | if (!chunk) { |
| 384 | put_inotify_watch(&old->watch); | ||
| 384 | return -ENOMEM; | 385 | return -ENOMEM; |
| 386 | } | ||
| 385 | 387 | ||
| 386 | mutex_lock(&inode->inotify_mutex); | 388 | mutex_lock(&inode->inotify_mutex); |
| 387 | if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) { | 389 | if (inotify_clone_watch(&old->watch, &chunk->watch) < 0) { |
| @@ -425,7 +427,8 @@ static int tag_chunk(struct inode *inode, struct audit_tree *tree) | |||
| 425 | spin_unlock(&hash_lock); | 427 | spin_unlock(&hash_lock); |
| 426 | inotify_evict_watch(&old->watch); | 428 | inotify_evict_watch(&old->watch); |
| 427 | mutex_unlock(&inode->inotify_mutex); | 429 | mutex_unlock(&inode->inotify_mutex); |
| 428 | put_inotify_watch(&old->watch); | 430 | put_inotify_watch(&old->watch); /* pair to inotify_find_watch */ |
| 431 | put_inotify_watch(&old->watch); /* and kill it */ | ||
| 429 | return 0; | 432 | return 0; |
| 430 | } | 433 | } |
| 431 | 434 | ||
