aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/audit.c
diff options
context:
space:
mode:
authorGao feng <gaofeng@cn.fujitsu.com>2013-12-17 11:10:42 +0800
committerEric Paris <eparis@redhat.com>2014-01-13 22:32:49 -0500
commitde92fc97e12d4b9170d1ab3dbccbdcb8c56add31 (patch)
tree1398d88a4f074862def8c855b2ed5a62d673beb8 /kernel/audit.c
parentaudit: print error message when fail to create audit socket (diff)
downloadlinux-dev-de92fc97e12d4b9170d1ab3dbccbdcb8c56add31.tar.xz
linux-dev-de92fc97e12d4b9170d1ab3dbccbdcb8c56add31.zip
audit: fix incorrect set of audit_sock
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> Acked-by: Eric Paris <eparis@redhat.com> Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel/audit.c')
-rw-r--r--kernel/audit.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/audit.c b/kernel/audit.c
index b27b7063654c..ef5bd63f5cb8 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -821,7 +821,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);