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]
Date:   Wed, 24 May 2017 16:19:59 +0200
From:   "Lino Sanfilippo" <LinoSanfilippo@....de>
To:     "Stefan Wahren" <stefan.wahren@...e.com>
Cc:     "Rob Herring" <robh+dt@...nel.org>,
        "Mark Rutland" <mark.rutland@....com>,
        "David S. Miller" <davem@...emloft.net>,
        linux-serial@...r.kernel.org, "Jiri Slaby" <jslaby@...e.com>,
        "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
        netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
        "Jakub Kicinski" <kubakici@...pl>, devicetree@...r.kernel.org
Subject: Aw: Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART
 driver

Hi,

> Gesendet: Mittwoch, 24. Mai 2017 um 11:06 Uhr
> Von: "Stefan Wahren" <stefan.wahren@...e.com>
> An: "Lino Sanfilippo" <LinoSanfilippo@....de>, "Rob Herring" <robh+dt@...nel.org>, "Mark Rutland" <mark.rutland@....com>, "David S. Miller" <davem@...emloft.net>
> Cc: linux-serial@...r.kernel.org, "Jiri Slaby" <jslaby@...e.com>, "Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, netdev@...r.kernel.org, linux-kernel@...r.kernel.org, "Jakub Kicinski" <kubakici@...pl>, devicetree@...r.kernel.org
> Betreff: Re: [PATCH v6 net-next 17/17] net: qualcomm: add QCA7000 UART driver
>
> Am 23.05.2017 um 23:01 schrieb Lino Sanfilippo:
> > On 23.05.2017 21:38, Stefan Wahren wrote:
> >>> Lino Sanfilippo <LinoSanfilippo@....de> hat am 23. Mai 2017 um 20:16 geschrieben:
> >>>
> >>> I suggest to avoid this possible race by first unregistering the netdevice and then 
> >>> calling cancel_work_sync().
> >> What makes you sure that's safe to unregister the netdev while the tx work queue is possibly active?
> > unregister_netdevice() calls netdev_close() if the interface is still up. netdev_close() calls flush_work()
> > so the unregistration is delayed until the tx work function is finished. Furthermore both close() and
> > tx work are synchronized by means of the qca->lock which also guarantees that unregister_netdevice() wont
> > be finished until the tx work is done.
> >
> 
> Thanks for the explanation. I suspect there could be the same race
> between serdev_device_close() and the tx work queue.
> 
> So i would propose a variant of your original suggestion:
> 
> unregister_netdev(qca->net_dev);
> 
> /* Flush any pending characters in the driver. */
> serdev_device_close(serdev);
> cancel_work_sync(&qca->tx_work);
> 
> Since we have the same pattern in the error path of the probe function,
> the same applies there.

Agreed, it is much cleaner to have the same cleanup pattern in remove() as
we have in (error case of) probe().

Regards,
Lino

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ