[RFC PATCH v3] audit: use proper refcount locking on audit_sock

Cong Wang xiyou.wangcong at gmail.com
Wed Dec 14 00:19:01 UTC 2016


On Tue, Dec 13, 2016 at 7:03 AM, Richard Guy Briggs <rgb at redhat.com> wrote:
> @@ -1283,8 +1299,10 @@ static void __net_exit audit_net_exit(struct net *net)
>  {
>         struct audit_net *aunet = net_generic(net, audit_net_id);
>         struct sock *sock = aunet->nlsk;
> +       mutex_lock(&audit_cmd_mutex);
>         if (sock == audit_sock)
>                 auditd_reset();
> +       mutex_unlock(&audit_cmd_mutex);

This still doesn't look correct to me, b/c here we release the audit_sock
refcnt twice:

1) inside audit_reset()
2) netlink_kernel_release()




More information about the Linux-audit mailing list