Skip to content

Commit 724e4fc

Browse files
rgbriggseparis
authored andcommitted
audit: log on errors from filter user rules
An error on an AUDIT_NEVER rule disabled logging on that rule. On error on AUDIT_NEVER rules, log. Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Eric Paris <eparis@redhat.com>
1 parent 6dd80ab commit 724e4fc

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

‎kernel/audit.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,7 +869,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
869869
return 0;
870870

871871
err = audit_filter_user(msg_type);
872-
if (err == 1) {
872+
if (err == 1) { /* match or error */
873873
err = 0;
874874
if (msg_type == AUDIT_USER_TTY) {
875875
err = tty_audit_push_current();

‎kernel/auditfilter.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,19 +1290,22 @@ int audit_filter_user(int type)
12901290
{
12911291
enum audit_state state = AUDIT_DISABLED;
12921292
struct audit_entry *e;
1293-
int ret = 1;
1293+
int rc, ret;
1294+
1295+
ret = 1; /* Audit by default */
12941296

12951297
rcu_read_lock();
12961298
list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_USER], list) {
1297-
if (audit_filter_user_rules(&e->rule, type, &state)) {
1298-
if (state == AUDIT_DISABLED)
1299+
rc = audit_filter_user_rules(&e->rule, type, &state);
1300+
if (rc) {
1301+
if (rc > 0 && state == AUDIT_DISABLED)
12991302
ret = 0;
13001303
break;
13011304
}
13021305
}
13031306
rcu_read_unlock();
13041307

1305-
return ret; /* Audit by default */
1308+
return ret;
13061309
}
13071310

13081311
int audit_filter_type(int type)

0 commit comments

Comments
 (0)