Skip to content

Commit

Permalink
audit: remove needless switch in AUDIT_SET
Browse files Browse the repository at this point in the history
If userspace specified that it was setting values via the mask we do not
need a second check to see if they also set the version field high
enough to understand those values.  (clearly if they set the mask they
knew those values).

Signed-off-by: Eric Paris <[email protected]>
  • Loading branch information
eparis committed Jan 14, 2014
1 parent 70249a9 commit 3f0c5fa
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -834,22 +834,15 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
if (err < 0)
return err;
}
switch (s.version) {
/* add future vers # cases immediately below and allow
* to fall through */
case 2:
if (s.mask & AUDIT_STATUS_BACKLOG_WAIT_TIME) {
if (sizeof(s) > (size_t)nlh->nlmsg_len)
return -EINVAL;
if (s.backlog_wait_time < 0 ||
s.backlog_wait_time > 10*AUDIT_BACKLOG_WAIT_TIME)
return -EINVAL;
err = audit_set_backlog_wait_time(s.backlog_wait_time);
if (err < 0)
return err;
}
default:
break;
if (s.mask & AUDIT_STATUS_BACKLOG_WAIT_TIME) {
if (sizeof(s) > (size_t)nlh->nlmsg_len)
return -EINVAL;
if (s.backlog_wait_time < 0 ||
s.backlog_wait_time > 10*AUDIT_BACKLOG_WAIT_TIME)
return -EINVAL;
err = audit_set_backlog_wait_time(s.backlog_wait_time);
if (err < 0)
return err;
}
break;
}
Expand Down

0 comments on commit 3f0c5fa

Please sign in to comment.