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]
Message-ID: <20250528-gpio_keys_preempt_rt-v2-2-3fc55a9c3619@foss.st.com>
Date: Wed, 28 May 2025 10:50:22 +0200
From: Gatien Chevallier <gatien.chevallier@...s.st.com>
To: Dmitry Torokhov <dmitry.torokhov@...il.com>,
        Sebastian Andrzej Siewior
	<bigeasy@...utronix.de>,
        Clark Williams <clrkwllms@...nel.org>,
        Steven
 Rostedt <rostedt@...dmis.org>,
        Paul Cercueil <paul@...pouillou.net>
CC: <linux-input@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-rt-devel@...ts.linux.dev>,
        Gatien Chevallier
	<gatien.chevallier@...s.st.com>,
        <fabrice.gasnier@...s.st.com>
Subject: [PATCH v2 2/2] 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: 019002f20cb5 ("Input: gpio-keys - use hrtimer for release timer")
Signed-off-by: Gatien Chevallier <gatien.chevallier@...s.st.com>
---
 drivers/input/keyboard/gpio_keys.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index d884538107c9654d21e37fa20e0b3b6cd9a25ee4..f9db86da0818b24d3b6611b4d4e23c96846dbf18 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -449,6 +449,8 @@ static enum hrtimer_restart gpio_keys_irq_timer(struct hrtimer *t)
 						      release_timer);
 	struct input_dev *input = bdata->input;
 
+	guard(spinlock_irqsave)(&bdata->lock);
+
 	if (bdata->key_pressed) {
 		input_report_key(input, *bdata->code, 0);
 		input_sync(input);

-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ