Commit 20c6aaa39ab735c7ed78e4e5a214d250efae0a6e

Authored by zhangxiliang
Committed by Al Viro
1 parent 980dfb0db3

[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>

Showing 1 changed file with 8 additions and 3 deletions Side-by-side Diff

... ... @@ -707,12 +707,14 @@
707 707 if (status_get->mask & AUDIT_STATUS_ENABLED) {
708 708 err = audit_set_enabled(status_get->enabled,
709 709 loginuid, sessionid, sid);
710   - if (err < 0) return err;
  710 + if (err < 0)
  711 + return err;
711 712 }
712 713 if (status_get->mask & AUDIT_STATUS_FAILURE) {
713 714 err = audit_set_failure(status_get->failure,
714 715 loginuid, sessionid, sid);
715   - if (err < 0) return err;
  716 + if (err < 0)
  717 + return err;
716 718 }
717 719 if (status_get->mask & AUDIT_STATUS_PID) {
718 720 int new_pid = status_get->pid;
719 721  
... ... @@ -725,9 +727,12 @@
725 727 audit_pid = new_pid;
726 728 audit_nlk_pid = NETLINK_CB(skb).pid;
727 729 }
728   - if (status_get->mask & AUDIT_STATUS_RATE_LIMIT)
  730 + if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) {
729 731 err = audit_set_rate_limit(status_get->rate_limit,
730 732 loginuid, sessionid, sid);
  733 + if (err < 0)
  734 + return err;
  735 + }
731 736 if (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT)
732 737 err = audit_set_backlog_limit(status_get->backlog_limit,
733 738 loginuid, sessionid, sid);