public inbox for linux-audit@redhat.com
 help / color / mirror / Atom feed
From: Richard Guy Briggs <rgb@redhat.com>
To: Gao feng <gaofeng@cn.fujitsu.com>
Cc: linux-audit@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] audit: fix incorrect set of audit_sock
Date: Thu, 19 Dec 2013 20:38:28 -0500	[thread overview]
Message-ID: <20131220013828.GC14944@madcap2.tricolour.ca> (raw)
In-Reply-To: <1387249842-27793-2-git-send-email-gaofeng@cn.fujitsu.com>

On 13/12/17, Gao feng wrote:
> NETLINK_CB(skb).sk is the socket of user space process,
> netlink_unicast in kauditd_send_skb wants the kernel
> side socket. Since the sk_state of audit netlink socket
> is not NETLINK_CONNECTED, so the netlink_getsockbyportid
> doesn't return -ECONNREFUSED.
> 
> And the socket of userspace process can be released anytime,
> so the audit_sock may point to invalid socket.
> 
> this patch sets the audit_sock to the kernel side audit
> netlink socket.

Thank you.

> Signed-off-by: Gao feng <gaofeng@cn.fujitsu.com>
> ---
>  kernel/audit.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/kernel/audit.c b/kernel/audit.c
> index 041b951..ff1d1d7 100644
> --- a/kernel/audit.c
> +++ b/kernel/audit.c
> @@ -822,7 +822,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
>  				audit_log_config_change("audit_pid", new_pid, audit_pid, 1);
>  			audit_pid = new_pid;
>  			audit_nlk_portid = NETLINK_CB(skb).portid;
> -			audit_sock = NETLINK_CB(skb).sk;
> +			audit_sock = skb->sk;
>  		}
>  		if (s.mask & AUDIT_STATUS_RATE_LIMIT) {
>  			err = audit_set_rate_limit(s.rate_limit);
> -- 
> 1.8.3.1

- RGB

--
Richard Guy Briggs <rbriggs@redhat.com>
Senior Software Engineer, Kernel Security, AMER ENG Base Operating Systems, Red Hat
Remote, Ottawa, Canada
Voice: +1.647.777.2635, Internal: (81) 32635, Alt: +1.613.693.0684x3545

  parent reply	other threads:[~2013-12-20  1:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-17  3:10 [PATCH 1/2] audit: print error message when fail to create audit socket Gao feng
2013-12-17  3:10 ` [PATCH 2/2] audit: fix incorrect set of audit_sock Gao feng
2013-12-17 16:02   ` Eric Paris
2013-12-20  1:38   ` Richard Guy Briggs [this message]
2013-12-17 15:56 ` [PATCH 1/2] audit: print error message when fail to create audit socket Eric Paris
2013-12-20  1:34   ` Richard Guy Briggs
2014-01-08  0:53 ` Andrew Morton
2014-01-08  1:18   ` Gao feng
2014-01-08  3:30     ` Richard Guy Briggs

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=20131220013828.GC14944@madcap2.tricolour.ca \
    --to=rgb@redhat.com \
    --cc=gaofeng@cn.fujitsu.com \
    --cc=linux-audit@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /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