Re: [net v2] net: dsa: microchip: fix race condition

2020-10-06 Thread Jakub Kicinski
On Tue, 6 Oct 2020 17:56:51 +0200 Christian Eggers wrote: > Fixes: 7c6ff470aa ("net: dsa: microchip: add MIB counter reading support") Fixes tag: Fixes: 7c6ff470aa ("net: dsa: microchip: add MIB counter reading support") Has these problem(s): - SHA1 should be at least 12 digits long

Re: [net v2] net: dsa: microchip: fix race condition

2020-10-06 Thread Vladimir Oltean
On Tue, Oct 06, 2020 at 06:30:57PM +0200, Christian Eggers wrote: > If think that ksz_switch_remove() will not be called at all if there is an > error in the probe path. Indeed. > In all other cases, the work should be queued. In that case, it looks like the "if" condition can be removed in a fu

[net v2] net: dsa: microchip: fix race condition

2020-10-06 Thread Christian Eggers
Between queuing the delayed work and finishing the setup of the dsa ports, the process may sleep in request_module() (via phy_device_create()) and the queued work may be executed prior to the switch net devices being registered. In ksz_mib_read_work(), a NULL dereference will happen within netof_ca

Re: [net v2] net: dsa: microchip: fix race condition

2020-10-06 Thread Christian Eggers
On Tuesday, 6 October 2020, 18:21:25 CEST, Vladimir Oltean wrote: > On Tue, Oct 06, 2020 at 05:56:51PM +0200, Christian Eggers wrote: > > - Checking for mib_read_interval in ksz_switch_remove() can be obmitted, > > as the condition is always true when ksz_switch_remove() is called. > > If there'

Re: [net v2] net: dsa: microchip: fix race condition

2020-10-06 Thread Vladimir Oltean
On Tue, Oct 06, 2020 at 07:21:25PM +0300, Vladimir Oltean wrote: > You forgot to copy Florian's review tag from v1. Ah, Florian did not leave a review tag in v1. Just a comment: > don't you need to pair the test for dev->mib_read_internal being non > zero with setting it to zero in ksz_switch_unr

Re: [net v2] net: dsa: microchip: fix race condition

2020-10-06 Thread Vladimir Oltean
On Tue, Oct 06, 2020 at 05:56:51PM +0200, Christian Eggers wrote: > Between queuing the delayed work and finishing the setup of the dsa > ports, the process may sleep in request_module() (via > phy_device_create()) and the queued work may be executed prior to the > switch net devices being register