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-next>] [day] [month] [year] [list]
Message-ID: <20251203105206.24453-1-johan@kernel.org>
Date: Wed,  3 Dec 2025 11:52:06 +0100
From: Johan Hovold <johan@...nel.org>
To: Linus Walleij <linusw@...nel.org>,
	Bartosz Golaszewski <brgl@...nel.org>
Cc: linux-gpio@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Johan Hovold <johan@...nel.org>
Subject: [PATCH] gpio: mmio: fix bad guard conversion

A recent spinlock guard conversion consistently used the wrong guard so
that interrupts are no longer disabled while holding the chip lock
(which can cause deadlocks).

Fixes: 7e061b462b3d ("gpio: mmio: use lock guards")
Cc: Bartosz Golaszewski <brgl@...nel.org>
Cc: Linus Walleij <linusw@...nel.org>
Signed-off-by: Johan Hovold <johan@...nel.org>
---
 drivers/gpio/gpio-mmio.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/gpio/gpio-mmio.c b/drivers/gpio/gpio-mmio.c
index b3a26a06260b..5daf962b0323 100644
--- a/drivers/gpio/gpio-mmio.c
+++ b/drivers/gpio/gpio-mmio.c
@@ -231,7 +231,7 @@ static int gpio_mmio_set(struct gpio_chip *gc, unsigned int gpio, int val)
 	struct gpio_generic_chip *chip = to_gpio_generic_chip(gc);
 	unsigned long mask = gpio_mmio_line2mask(gc, gpio);
 
-	guard(raw_spinlock)(&chip->lock);
+	guard(raw_spinlock_irqsave)(&chip->lock);
 
 	if (val)
 		chip->sdata |= mask;
@@ -262,7 +262,7 @@ static int gpio_mmio_set_set(struct gpio_chip *gc, unsigned int gpio, int val)
 	struct gpio_generic_chip *chip = to_gpio_generic_chip(gc);
 	unsigned long mask = gpio_mmio_line2mask(gc, gpio);
 
-	guard(raw_spinlock)(&chip->lock);
+	guard(raw_spinlock_irqsave)(&chip->lock);
 
 	if (val)
 		chip->sdata |= mask;
@@ -302,7 +302,7 @@ static void gpio_mmio_set_multiple_single_reg(struct gpio_chip *gc,
 	struct gpio_generic_chip *chip = to_gpio_generic_chip(gc);
 	unsigned long set_mask, clear_mask;
 
-	guard(raw_spinlock)(&chip->lock);
+	guard(raw_spinlock_irqsave)(&chip->lock);
 
 	gpio_mmio_multiple_get_masks(gc, mask, bits, &set_mask, &clear_mask);
 
@@ -391,7 +391,7 @@ static int gpio_mmio_dir_in(struct gpio_chip *gc, unsigned int gpio)
 {
 	struct gpio_generic_chip *chip = to_gpio_generic_chip(gc);
 
-	scoped_guard(raw_spinlock, &chip->lock) {
+	scoped_guard(raw_spinlock_irqsave, &chip->lock) {
 		chip->sdir &= ~gpio_mmio_line2mask(gc, gpio);
 
 		if (chip->reg_dir_in)
@@ -431,7 +431,7 @@ static void gpio_mmio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
 {
 	struct gpio_generic_chip *chip = to_gpio_generic_chip(gc);
 
-	guard(raw_spinlock)(&chip->lock);
+	guard(raw_spinlock_irqsave)(&chip->lock);
 
 	chip->sdir |= gpio_mmio_line2mask(gc, gpio);
 
-- 
2.51.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ