Linux-audit Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Guy Briggs <rgb@redhat.com>
To: Paul Moore <pmoore@redhat.com>
Cc: linux-audit@redhat.com
Subject: Re: [RFC PATCH 1/4] audit: combine audit_receive() and audit_receive_skb()
Date: Sun, 9 Apr 2017 23:38:20 -0400	[thread overview]
Message-ID: <20170410033820.GA1572@madcap2.tricolour.ca> (raw)
In-Reply-To: <149012272726.14936.5372534720992976023.stgit@sifl>

On 2017-03-21 14:58, Paul Moore wrote:
> From: Paul Moore <paul@paul-moore.com>
> 
> There is no reason to have both of these functions, combine the two.
> 
> Signed-off-by: Paul Moore <paul@paul-moore.com>

Reviewed-by: Richard Guy Briggs <rgb@redhat.com>

> ---
>  kernel/audit.c |   19 ++++++++-----------
>  1 file changed, 8 insertions(+), 11 deletions(-)
> 
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 2f4964cfde0b..4037869b4b64 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -1381,11 +1381,14 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
>  	return err < 0 ? err : 0;
>  }
>  
> -/*
> - * Get message from skb.  Each message is processed by audit_receive_msg.
> - * Malformed skbs with wrong length are discarded silently.
> +/**
> + * audit_receive - receive messages from a netlink control socket
> + * @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;
>  	/*
> @@ -1398,6 +1401,7 @@ static void audit_receive_skb(struct sk_buff *skb)
>  	nlh = nlmsg_hdr(skb);
>  	len = skb->len;
>  
> +	mutex_lock(&audit_cmd_mutex);
>  	while (nlmsg_ok(nlh, len)) {
>  		err = audit_receive_msg(skb, nlh);
>  		/* if err or if this message says it wants a response */
> @@ -1406,13 +1410,6 @@ static void audit_receive_skb(struct sk_buff *skb)
>  
>  		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);
>  }
>  
> 
> --
> Linux-audit mailing list
> Linux-audit@redhat.com
> https://www.redhat.com/mailman/listinfo/linux-audit

- RGB

--
Richard Guy Briggs <rgb@redhat.com>
Sr. S/W Engineer, Kernel Security, Base Operating Systems
Remote, Ottawa, Red Hat Canada
IRC: rgb, SunRaycer
Voice: +1.647.777.2635, Internal: (81) 32635

  reply	other threads:[~2017-04-10  3:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-21 18:58 [RFC PATCH 0/4] Assorted audit fixes/improvements Paul Moore
2017-03-21 18:58 ` [RFC PATCH 1/4] audit: combine audit_receive() and audit_receive_skb() Paul Moore
2017-04-10  3:38   ` Richard Guy Briggs [this message]
2017-04-11 19:47     ` Paul Moore
2017-03-21 18:58 ` [RFC PATCH 2/4] audit: kernel generated netlink traffic should have a portid of 0 Paul Moore
2017-04-10  3:41   ` Richard Guy Briggs
2017-04-11 19:49     ` Paul Moore
2017-03-21 18:59 ` [RFC PATCH 3/4] audit: store the auditd PID as a pid struct instead of pid_t Paul Moore
2017-04-10  4:30   ` Richard Guy Briggs
2017-04-11 19:56     ` Paul Moore
2017-03-21 18:59 ` [RFC PATCH 4/4] audit: use kmem_cache to manage the audit_buffer cache Paul Moore
2017-03-21 19:04   ` Paul Moore
2017-04-10  4:04   ` Richard Guy Briggs
2017-04-11 20:07     ` Paul Moore
2017-04-12  4:59       ` Richard Guy Briggs
2017-04-12 15:51         ` Paul Moore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170410033820.GA1572@madcap2.tricolour.ca \
    --to=rgb@redhat.com \
    --cc=linux-audit@redhat.com \
    --cc=pmoore@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox