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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iJOO9cbOqCNpRK4OrZy-L6P8aJJcPMjs5=RHF=fsjEe2Q@mail.gmail.com>
Date:   Thu, 17 Sep 2020 08:51:45 +0200
From:   Eric Dumazet <edumazet@...gle.com>
To:     Francesco Ruggeri <fruggeri@...sta.com>
Cc:     open list <linux-kernel@...r.kernel.org>,
        netdev <netdev@...r.kernel.org>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Taehee Yoo <ap420073@...il.com>,
        Andrii Nakryiko <andriin@...com>,
        Jiri Pirko <jiri@...lanox.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        David Miller <davem@...emloft.net>
Subject: Re: [PATCH] net: make netdev_wait_allrefs wake-able

On Thu, Sep 17, 2020 at 8:33 AM Francesco Ruggeri <fruggeri@...sta.com> wrote:
>
> >  static inline void dev_put(struct net_device *dev)
> >  {
> > +       struct task_struct *destroy_task = dev->destroy_task;
> > +
> >         this_cpu_dec(*dev->pcpu_refcnt);
> > +       if (destroy_task)
> > +               wake_up_process(destroy_task);
> >  }
>
> I just realized that this introduces a race, if dev_put drops the last
> reference, an already running netdev_wait_allrefs runs to completion
> and then dev_put tries to wake it up.
> Any suggestions on how to avoid this without resorting to
> locking?
>

Honestly I would not touch dev_put() at all.

Simply change the msleep(250) to something better, with maybe
exponential backoff.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ