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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240428174807.2051e3cd@jic23-huawei>
Date: Sun, 28 Apr 2024 17:48:07 +0100
From: Jonathan Cameron <jic23@...nel.org>
To: Ondřej Jirman <megi@....cz>
Cc: Andy Shevchenko <andy.shevchenko@...il.com>, Aren Moynihan
 <aren@...cevolution.org>, Lars-Peter Clausen <lars@...afoo.de>, Rob Herring
 <robh@...nel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
 Conor Dooley <conor+dt@...nel.org>, Chen-Yu Tsai <wens@...e.org>, Jernej
 Skrabec <jernej.skrabec@...il.com>, Samuel Holland <samuel@...lland.org>,
 Liam Girdwood <lgirdwood@...il.com>, Mark Brown <broonie@...nel.org>, Uwe
 Kleine-König <u.kleine-koenig@...gutronix.de>,
 devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
 linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev, Willow
 Barraco <contact@...lowbarraco.fr>
Subject: Re: [PATCH v2 2/6] iio: light: stk3310: Implement vdd supply and
 power it off during suspend

On Wed, 24 Apr 2024 22:00:46 +0200
Ondřej Jirman <megi@....cz> wrote:

> On Wed, Apr 24, 2024 at 08:31:27PM GMT, Andy Shevchenko wrote:
> > On Wed, Apr 24, 2024 at 7:14 PM Ondřej Jirman <megi@....cz> wrote:  
> > > On Wed, Apr 24, 2024 at 06:20:41PM GMT, Andy Shevchenko wrote:  
> > > > On Wed, Apr 24, 2024 at 3:59 PM Ondřej Jirman <megi@....cz> wrote:  
> > > > > On Wed, Apr 24, 2024 at 02:16:06AM GMT, Andy Shevchenko wrote:  
> > > > > > On Wed, Apr 24, 2024 at 1:41 AM Aren Moynihan <aren@...cevolution.org> wrote:  
> > 
> > ...
> >   
> > > > > > >         ret = stk3310_init(indio_dev);
> > > > > > >         if (ret < 0)
> > > > > > > -               return ret;
> > > > > > > +               goto err_vdd_disable;  
> > > > > >
> > > > > > This is wrong. You will have the regulator being disabled _before_
> > > > > > IRQ. Note, that the original code likely has a bug which sets states
> > > > > > before disabling IRQ and removing a handler.  
> > > > >
> > > > > How so? stk3310_init is called before enabling the interrupt.  
> > > >
> > > > Exactly, IRQ is registered with devm and hence the error path and
> > > > remove stages will got it in a wrong order.  
> > >
> > > Makes no sense.  
> > 
> > Huh?!
> >   
> > > IRQ is not enabled here, yet. So in error path, the code will
> > > just disable the regulator and devm will unref it later on. IRQ doesn't enter
> > > the picture here at all in the error path.  
> > 
> > Error path _after_ IRQ handler has been _successfully_ installed.
> > And complete ->remove() stage.  
> 
> Allright. So fixing the other issue I mentioned will fix this one too, because
> there will be no error path after IRQ enable, then.

Don't do reorder stuff past iio_device_register.
It generates a bunch of it's own issues wrt to functionality.
The iio_device_register() call is the last one because the device must be in a
state to correctly deal with all userspace actions by the time they are made
available.

Harden the driver to not call IIO core functions for false events if that
is easy to do, but there shouldn't be an issue if you do (if there is we should
address that in the IIO core).

Jonathan



> 
> kind regards,
> 	o.
> 
> > > > > Original code has a bug that IRQ is enabled before registering the
> > > > > IIO device,  
> > > >
> > > > Indeed, but this is another bug.
> > > >  
> > > > > so if IRQ is triggered before registration, iio_push_event
> > > > > from IRQ handler may be called on a not yet registered IIO device.
> > > > >
> > > > > Never saw it happen, though. :)  
> > > >
> > > > Because nobody cares enough to enable DEBUG_SHIRQ.  
> > >
> > > Nice debug tool. I bet it makes quite a mess when enabled. :)  
> > 
> > FWIW, I have had it enabled for ages, but I have only a few devices,
> > so I fixed a few cases in the past WRT shared IRQ issues.
> > 
> > -- 
> > With Best Regards,
> > Andy Shevchenko  


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ