Skip to content

Commit 8f38219

Browse files
GseoCdtor
authored andcommitted
Input: gpio-keys - fix possible concurrent access in gpio_keys_irq_timer()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Dmitry Torokhov <[email protected]>
1 parent f4a8f56 commit 8f38219

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)