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:   Fri, 20 Jan 2017 09:47:03 -0800
From:   Dmitry Torokhov <dmitry.torokhov@...il.com>
To:     Thierry Reding <thierry.reding@...il.com>
Cc:     linux-input@...r.kernel.org, David Lechner <david@...hnology.com>,
        linux-kernel@...r.kernel.org,
        Frieder Schrempf <frieder.schrempf@...eet.de>
Subject: Re: [PATCH v2 6/7] Input: pwm-beeper - add optional amplifier
 regulator

On Fri, Jan 20, 2017 at 11:19:16AM +0100, Thierry Reding wrote:
> On Thu, Jan 19, 2017 at 02:40:56PM -0800, Dmitry Torokhov wrote:
> [...]
> > diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
> > index 9964c46468d3..7b213e0ab06c 100644
> > --- a/drivers/input/misc/pwm-beeper.c
> > +++ b/drivers/input/misc/pwm-beeper.c
> > @@ -14,6 +14,7 @@
> >   */
> >  
> >  #include <linux/input.h>
> > +#include <linux/regulator/consumer.h>
> >  #include <linux/module.h>
> >  #include <linux/kernel.h>
> >  #include <linux/of.h>
> > @@ -25,30 +26,59 @@
> >  struct pwm_beeper {
> >  	struct input_dev *input;
> >  	struct pwm_device *pwm;
> > +	struct regulator *amplifier;
> >  	struct work_struct work;
> >  	unsigned long period;
> >  	bool suspended;
> > +	bool amplifier_on;
> 
> Why do you need to track this? I thought regulator_enable() and
> regulator_disable() were already reference counted?

That us exactly the issue: without the flag userspace application
sending:

EV_SND/SND_TONE/100
EV_SND/SND_TONE/200
EV_SND/SND_TONE/300
EV_SND/SND_TONE/200
EV_SND/SND_TONE/100
EV_SND/SND_TONE/0

will result in enable count of 4 (and not 0) and regulator will stay on
forever.

Thanks.

-- 
Dmitry

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ