Commit a9d16208 authored by Paul Moore's avatar Paul Moore

audit: combine audit_receive() and audit_receive_skb()

There is no reason to have both of these functions, combine the two.
Signed-off-by: default avatarPaul Moore <paul@paul-moore.com>
Reviewed-by: default avatarRichard Guy Briggs <rgb@redhat.com>
parent bd120ded
...@@ -1378,11 +1378,14 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh) ...@@ -1378,11 +1378,14 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
return err < 0 ? err : 0; return err < 0 ? err : 0;
} }
/* /**
* Get message from skb. Each message is processed by audit_receive_msg. * audit_receive - receive messages from a netlink control socket
* Malformed skbs with wrong length are discarded silently. * @skb: the message buffer
*
* Parse the provided skb and deal with any messages that may be present,
* malformed skbs are discarded.
*/ */
static void audit_receive_skb(struct sk_buff *skb) static void audit_receive(struct sk_buff *skb)
{ {
struct nlmsghdr *nlh; struct nlmsghdr *nlh;
/* /*
...@@ -1395,6 +1398,7 @@ static void audit_receive_skb(struct sk_buff *skb) ...@@ -1395,6 +1398,7 @@ static void audit_receive_skb(struct sk_buff *skb)
nlh = nlmsg_hdr(skb); nlh = nlmsg_hdr(skb);
len = skb->len; len = skb->len;
mutex_lock(&audit_cmd_mutex);
while (nlmsg_ok(nlh, len)) { while (nlmsg_ok(nlh, len)) {
err = audit_receive_msg(skb, nlh); err = audit_receive_msg(skb, nlh);
/* if err or if this message says it wants a response */ /* if err or if this message says it wants a response */
...@@ -1403,13 +1407,6 @@ static void audit_receive_skb(struct sk_buff *skb) ...@@ -1403,13 +1407,6 @@ static void audit_receive_skb(struct sk_buff *skb)
nlh = nlmsg_next(nlh, &len); nlh = nlmsg_next(nlh, &len);
} }
}
/* Receive messages from netlink socket. */
static void audit_receive(struct sk_buff *skb)
{
mutex_lock(&audit_cmd_mutex);
audit_receive_skb(skb);
mutex_unlock(&audit_cmd_mutex); mutex_unlock(&audit_cmd_mutex);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment