Skip to content

Commit

Permalink
audit: fix oops removing watch if audit disabled
Browse files Browse the repository at this point in the history
Removing a watched file will oops if audit is disabled (auditctl -e 0).

To reproduce:
- auditctl -e 1
- touch /tmp/foo
- auditctl -w /tmp/foo
- auditctl -e 0
- rm /tmp/foo (or mv)

Signed-off-by: Tony Jones <tonyj@suse.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Tony Jones authored and Linus Torvalds committed Jun 24, 2007
1 parent 266f5aa commit 7b018b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/auditfilter.c
Original file line number Diff line number Diff line change
Expand Up @@ -947,7 +947,7 @@ static void audit_update_watch(struct audit_parent *parent,

/* If the update involves invalidating rules, do the inode-based
* filtering now, so we don't omit records. */
if (invalidating &&
if (invalidating && current->audit_context &&
audit_filter_inodes(current, current->audit_context) == AUDIT_RECORD_CONTEXT)
audit_set_auditable(current->audit_context);

Expand Down

0 comments on commit 7b018b2

Please sign in to comment.