Re: Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-19 Thread Willem de Bruijn
On Tue, Sep 19, 2017 at 12:09 PM, Willem de Bruijn wrote: > On Tue, Sep 19, 2017 at 3:21 AM, Nixiaoming wrote: >> On Fri, Sep 15, 2017 at 10:46 AM, Willem de Bruijn >> >> wrote: >> >>> >> >>> In case of failure we also need to unlink and free match. I >> >>> sent the following: >> >>> >> >>> htt

Re: Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-19 Thread Willem de Bruijn
On Tue, Sep 19, 2017 at 3:21 AM, Nixiaoming wrote: > On Fri, Sep 15, 2017 at 10:46 AM, Willem de Bruijn > > 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

Re:Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-19 Thread Nixiaoming
On Fri, Sep 15, 2017 at 10:46 AM, Willem de Bruijn 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 &&

Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-15 Thread Cong Wang
On Fri, Sep 15, 2017 at 10:46 AM, Willem de Bruijn wrote: > > In case of failure we also need to unlink and free match. I > sent the following: > > http://patchwork.ozlabs.org/patch/813945/ Ah, will take a look.

Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-15 Thread Willem de Bruijn
On Fri, Sep 15, 2017 at 1:41 PM, Cong Wang wrote: > On Thu, Sep 14, 2017 at 7:35 AM, Willem de Bruijn > wrote: >> On Thu, Sep 14, 2017 at 10:07 AM, nixiaoming wrote: >>> From: l00219569 >>> >>> If fanout_add is preempted after running po-> fanout = match >>> and before running __fanout_link, >>

Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-15 Thread Cong Wang
On Thu, Sep 14, 2017 at 7:35 AM, Willem de Bruijn wrote: > On Thu, Sep 14, 2017 at 10:07 AM, nixiaoming wrote: >> From: l00219569 >> >> If fanout_add is preempted after running po-> fanout = match >> and before running __fanout_link, >> it will cause BUG_ON when __unregister_prot_hook call __fan

Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-14 Thread Willem de Bruijn
On Thu, Sep 14, 2017 at 10:07 AM, nixiaoming wrote: > From: l00219569 > > If fanout_add is preempted after running po-> fanout = match > and before running __fanout_link, > it will cause BUG_ON when __unregister_prot_hook call __fanout_unlink > > so, we need add mutex_lock(&fanout_mutex) to __unr

[PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-14 Thread nixiaoming
From: l00219569 If fanout_add is preempted after running po-> fanout = match and before running __fanout_link, it will cause BUG_ON when __unregister_prot_hook call __fanout_unlink so, we need add mutex_lock(&fanout_mutex) to __unregister_prot_hook or add spin_lock(&po->bind_lock) before po-> fa

Re: [PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-14 Thread Willem de Bruijn
On Wed, Sep 13, 2017 at 10:40 PM, nixiaoming wrote: > If fanout_add is preempted after running po-> fanout = match > and before running __fanout_link, > it will cause BUG_ON when __unregister_prot_hook call __fanout_unlink > > so, we need add mutex_lock(&fanout_mutex) to __unregister_prot_hook > o

[PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-13 Thread nixiaoming
If fanout_add is preempted after running po-> fanout = match and before running __fanout_link, it will cause BUG_ON when __unregister_prot_hook call __fanout_unlink so, we need add mutex_lock(&fanout_mutex) to __unregister_prot_hook or add spin_lock(&po->bind_lock) before po-> fanout = match test

[PATCH] net/packet: fix race condition between fanout_add and __unregister_prot_hook

2017-09-13 Thread nixiaoming
If fanout_add is preempted after running po-> fanout = match and before running __fanout_link, it will cause BUG_ON when __unregister_prot_hook call __fanout_unlink so, we need add mutex_lock(&fanout_mutex) to __unregister_prot_hook or add spin_lock(&po->bind_lock) before po-> fanout = match test