lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAF=yD-JN_NLxY-eB1oGZ-BeYgnPhhROBzSxj_CWRShY=SugW3Q@mail.gmail.com>
Date:   Tue, 19 Sep 2017 12:12:38 -0400
From:   Willem de Bruijn <willemdebruijn.kernel@...il.com>
To:     Nixiaoming <nixiaoming@...wei.com>
Cc:     "xiyou.wangcong@...il.com" <xiyou.wangcong@...il.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

On Tue, Sep 19, 2017 at 12:09 PM, Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
> On Tue, Sep 19, 2017 at 3:21 AM, Nixiaoming <nixiaoming@...wei.com> wrote:
>> On Fri, Sep 15, 2017 at 10:46 AM, Willem de Bruijn
>>
>> <willemdebruijn.kernel@...il.com> wrote:
>>
>>>
>>
>>> In case of failure we also need to unlink and free match. I
>>
>>> sent the following:
>>
>>>
>>
>>> http://patchwork.ozlabs.org/patch/813945/
>>
>>
>>
>> +       spin_lock(&po->bind_lock);
>>
>> +       if (po->running &&
>>
>> +           match->type == type &&
>>
>>            match->prot_hook.type == po->prot_hook.type &&
>>
>>            match->prot_hook.dev == po->prot_hook.dev) {
>>
>>                 err = -ENOSPC;
>>
>> @@ -1761,6 +1760,13 @@  static int fanout_add(struct sock *sk, u16 id, u16
>> type_flags)
>>
>>                           err = 0;
>>
>>                 }
>>
>>        }
>>
>> +       spin_unlock(&po->bind_lock);
>>
>> +
>>
>> +       if (err && !refcount_read(&match->sk_ref)) {
>>
>> +                list_del(&match->list);
>>
>> +                kfree(match);
>>
>> +       }
>>
>>
>>
>>
>>
>> In the function fanout_add add spin_lock to protect po-> running and po->
>> fanout,
>>
>> then whether it should be in the function fanout_release also add spin_lock
>> protection ?
>
> po->bind_lock is held when registering and unregistering the
> protocol hook. fanout_release does access po->running or
> prot_hook.

whoops. does *not* access.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ