From: Gao feng <gaofeng@cn.fujitsu.com>
To: linux-audit@redhat.com
Cc: linux-kernel@vger.kernel.org, rgb@redhat.com, eparis@redhat.com,
Gao feng <gaofeng@cn.fujitsu.com>
Subject: [PATCH 2/2] audit: fix incorrect set of audit_sock
Date: Tue, 17 Dec 2013 11:10:42 +0800 [thread overview]
Message-ID: <1387249842-27793-2-git-send-email-gaofeng@cn.fujitsu.com> (raw)
In-Reply-To: <1387249842-27793-1-git-send-email-gaofeng@cn.fujitsu.com>
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.
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
next prev parent reply other threads:[~2013-12-17 3:10 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 ` Gao feng [this message]
2013-12-17 16:02 ` [PATCH 2/2] audit: fix incorrect set of audit_sock Eric Paris
2013-12-20 1:38 ` Richard Guy Briggs
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=1387249842-27793-2-git-send-email-gaofeng@cn.fujitsu.com \
--to=gaofeng@cn.fujitsu.com \
--cc=eparis@redhat.com \
--cc=linux-audit@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rgb@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