Skip to contentSkip to conversation

Fix the bug of using AUDIT_STATUS_RATE_LIMIT when set fail, no error output.

PATCH In review zhangxiliang 4 participants 4 messages Jul 31, 2008 Audit

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 kernel/audit.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/audit.c +3 -1
index e092f1c..38a4080 100644
@@ -725,9 +725,11 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 			audit_pid = new_pid;
 			audit_nlk_pid = NETLINK_CB(skb).pid;
 		}
-		if (status_get->mask & AUDIT_STATUS_RATE_LIMIT)
+		if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) {
 			err = audit_set_rate_limit(status_get->rate_limit,
 						   loginuid, sessionid, sid);
+			if (err < 0) return err;
+		}
 		if (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT)
 			err = audit_set_backlog_limit(status_get->backlog_limit,
 						      loginuid, sessionid, sid);
Signature · 6 lines
1.5.4.2


-- 
Regards
Zhang Xiliang
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · zhangxiliang

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.

man, it gives me the heebee jeebies with the coding style but it follows everything else

Quoted 25 lines
---
 kernel/audit.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/audit.c +3 -1
index e092f1c..38a4080 100644
@@ -725,9 +725,11 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
 			audit_pid = new_pid;
 			audit_nlk_pid = NETLINK_CB(skb).pid;
 		}
-		if (status_get->mask & AUDIT_STATUS_RATE_LIMIT)
+		if (status_get->mask & AUDIT_STATUS_RATE_LIMIT) {
 			err = audit_set_rate_limit(status_get->rate_limit,
 						   loginuid, sessionid, sid);
+			if (err < 0) return err;
+		}
 		if (status_get->mask & AUDIT_STATUS_BACKLOG_LIMIT)
 			err = audit_set_backlog_limit(status_get->backlog_limit,
 						      loginuid, sessionid, sid);
Signature · 1 line
1.5.4.2
#2 lore raw
Quoted 8 lines · Eric Paris
Quoted 4 lines · zhangxiliang

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.

man, it gives me the heebee jeebies with the coding style but it follows everything else

Sanitized, applied, pushed to audit-current (audit.b53)

#3 lore raw
Quoted 11 lines · On Thu, 31 Jul 2008 17:04:38 +0100 Al Viro <[email protected]> wrote:
Quoted 8 lines · Eric Paris
Quoted 4 lines · zhangxiliang

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.

man, it gives me the heebee jeebies with the coding style but it follows everything else

Sanitized, applied, pushed to audit-current (audit.b53)

That tree doesn't appear to be in the linux-next lineup. Fixable, please?