Skip to content

Commit 6f3e940

Browse files
GseoCopsiff
authored andcommitted
Input: gpio-keys - fix possible concurrent access in gpio_keys_irq_timer()
commit 8f38219 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> (cherry picked from commit 0f7100e8d9f0f0396a922f0f267cd60a8c4beecc)
1 parent 2f7c4a8 commit 6f3e940

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

drivers/input/keyboard/gpio_keys.c

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

458+
guard(spinlock_irqsave)(&bdata->lock);
459+
458460
if (bdata->key_pressed) {
459461
input_report_key(input, *bdata->code, 0);
460462
input_sync(input);

0 commit comments

Comments
 (0)