Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1541717

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

From Cong Wang <xiyou.wangcong@gmail.com>
Newsgroups linux.kernel
Subject Re: [RFC PATCH v3] audit: use proper refcount locking on audit_sock
Date 2016-12-14 07:40 +0100
Message-ID <sObol-35x-3@gated-at.bofh.it> (permalink)
References <sNvIu-30q-41@gated-at.bofh.it> <sNWSm-2IE-49@gated-at.bofh.it> <sO5sC-7Vh-45@gated-at.bofh.it> <sO93b-1Im-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Dec 13, 2016 at 8:00 PM, Richard Guy Briggs <rgb@redhat.com> wrote:
> On 2016-12-13 16:19, Cong Wang wrote:
>> On Tue, Dec 13, 2016 at 7:03 AM, Richard Guy Briggs <rgb@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()
>
> The audit_reset() refcount decrement corresponds to a setting of
> audit_sock only if audit_sock is still non-NULL.
>

Hmm, thinking about it again, looks like the sock == audit_sock
and audit_sock != NULL checks can guarantee we are safe. So,

Reviewed-by: Cong Wang <xiyou.wangcong@gmail.com>

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

Re: netlink: GPF in sock_sndtimeo Richard Guy Briggs <rgb@redhat.com> - 2016-12-12 11:10 +0100
  Re: netlink: GPF in sock_sndtimeo Cong Wang <xiyou.wangcong@gmail.com> - 2016-12-13 01:20 +0100
    Re: netlink: GPF in sock_sndtimeo Richard Guy Briggs <rgb@redhat.com> - 2016-12-13 12:00 +0100
      Re: netlink: GPF in sock_sndtimeo Cong Wang <xiyou.wangcong@gmail.com> - 2016-12-14 01:40 +0100
        Re: netlink: GPF in sock_sndtimeo Richard Guy Briggs <rgb@redhat.com> - 2016-12-14 05:20 +0100
  [RFC PATCH v3] audit: use proper refcount locking on audit_sock Richard Guy Briggs <rgb@redhat.com> - 2016-12-13 16:10 +0100
    Re: [RFC PATCH v3] audit: use proper refcount locking on audit_sock Paul Moore <paul@paul-moore.com> - 2016-12-13 22:00 +0100
    Re: [RFC PATCH v3] audit: use proper refcount locking on audit_sock Cong Wang <xiyou.wangcong@gmail.com> - 2016-12-14 01:20 +0100
      Re: [RFC PATCH v3] audit: use proper refcount locking on audit_sock Richard Guy Briggs <rgb@redhat.com> - 2016-12-14 05:10 +0100
        Re: [RFC PATCH v3] audit: use proper refcount locking on audit_sock Cong Wang <xiyou.wangcong@gmail.com> - 2016-12-14 07:40 +0100

csiph-web