Re: [PATCH v2 4/7] Input: pwm-beeper - fix race when suspending

From: Thierry Reding
Date: Fri Jan 20 2017 - 05:14:35 EST


On Thu, Jan 19, 2017 at 02:40:54PM -0800, Dmitry Torokhov wrote:
> Usually userspace sends SND_BELL and SND_TONE events, and by the time
> pwm_beeper_suspend() runs userpsace is already frozen, but theoretically
> in-kernel users may send these events too, and that may cause
> pwm_beeper_event() scheduling another work after we canceled it.
>
> Let's introduce a "suspended" flag and check it in pwm_beeper_event() to
> avoid this race.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@xxxxxxxxx>
> ---
> drivers/input/misc/pwm-beeper.c | 21 ++++++++++++++++++---
> 1 file changed, 18 insertions(+), 3 deletions(-)

Reviewed-by: Thierry Reding <thierry.reding@xxxxxxxxx>

Attachment: signature.asc
Description: PGP signature