Skip to content

Commit 20c6aaa

Browse files
zhangxiliangAl Viro
authored andcommitted
[PATCH] Fix the bug of using AUDIT_STATUS_RATE_LIMIT when set fail, no error output.
When the "status_get->mask" is "AUDIT_STATUS_RATE_LIMIT || AUDIT_STATUS_BACKLOG_LIMIT". If "audit_set_rate_limit" fails and "audit_set_backlog_limit" succeeds, the "err" value will be greater than or equal to 0. It will miss the failure of rate set. Signed-off-by: Zhang Xiliang <zhangxiliang@cn.fujitsu.com> Acked-by: Eric Paris <eparis@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 980dfb0 commit 20c6aaa

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎kernel/audit.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -707,12 +707,14 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
707707
if (status_get->mask & AUDIT_STATUS_ENABLED) {
708708
err = audit_set_enabled(status_get->enabled,
709709
loginuid, sessionid, sid);
710-
if (err < 0) return err;
710+
if (err < 0)
711+
return err;
711712
}
712713
if (status_get->mask & AUDIT_STATUS_FAILURE) {
713714
err = audit_set_failure(status_get->failure,
714715
loginuid, sessionid, sid);
715-
if (err < 0) return err;
716+
if (err < 0)
717+
return err;
716718
}
717719
if (status_get->mask & AUDIT_STATUS_PID) {
718720
int new_pid = status_get->pid;
@@ -725,9 +727,12 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
725727
audit_pid = new_pid;
726728
audit_nlk_pid = NETLINK_CB(skb).pid;
727729
}
728-
if (status_get->mask & AUDIT_STATUS_RATE_LIMIT)
730+
if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) {
729731
err = audit_set_rate_limit(status_get->rate_limit,
730732
loginuid, sessionid, sid);
733+
if (err < 0)
734+
return err;
735+
}
731736
if (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT)
732737
err = audit_set_backlog_limit(status_get->backlog_limit,
733738
loginuid, sessionid, sid);

0 commit comments

Comments
 (0)