Skip to content

Commit 37009d1

Browse files
GseoCsmb49
authored andcommitted
Input: gpio-keys - fix possible concurrent access in gpio_keys_irq_timer()
BugLink: https://bugs.launchpad.net/bugs/2120812 commit 8f38219fa139623c29db2cb0f17d0a197a86e344 upstream. gpio_keys_irq_isr() and gpio_keys_irq_timer() access the same resources. There could be a concurrent access if a GPIO interrupt occurs in parallel of a HR timer interrupt. Guard back those resources with a spinlock. Fixes: 019002f ("Input: gpio-keys - use hrtimer for release timer") Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Link: https://lore.kernel.org/r/20250528-gpio_keys_preempt_rt-v2-2-3fc55a9c3619@foss.st.com Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Noah Wager <noah.wager@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 2e2321a commit 37009d1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/input/keyboard/gpio_keys.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,8 @@ static enum hrtimer_restart gpio_keys_irq_timer(struct hrtimer *t)
449449
release_timer);
450450
struct input_dev *input = bdata->input;
451451

452+
guard(spinlock_irqsave)(&bdata->lock);
453+
452454
if (bdata->key_pressed) {
453455
input_report_key(input, *bdata->code, 0);
454456
input_sync(input);

0 commit comments

Comments
 (0)