mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gpio: of: fix potential misconfiguration of hogged lines
@ 2026-11-05 13:37 Bartosz Golaszewski
  2026-11-06 14:11 ` Mika Westerberg
  0 siblings, 1 reply; 2+ messages in thread
From: Bartosz Golaszewski @ 2026-11-05 13:37 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski, Mika Westerberg, Andy Shevchenko
  Cc: linux-gpio, linux-kernel, stable, Bartosz Golaszewski

In of_gpiochip_get_lflags() the local variable xlate_flags is declared
without being initialized before its address is passed to
of_xlate_and_get_gpiod_flags() when processing a devicetree gpio-hog
child node. If a driver uses an of_xlate() callback that doesn't update
the flags argument (like gpiochip_fwd_delay_of_xlate()) we'll end up
passing that uninitialized value to of_convert_gpio_flags(), potentially
misconfiguring the hogged GPIO.

Initialize xlate_flags to 0.

Cc: stable@vger.kernel.org
Fixes: d1d564ec4992 ("gpio: move hogs into GPIO core")
Closes: https://sashiko.dev/#/bug/linux-2bb44847-fd6e-406c-878d-9739da2cb8b5
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
---
 drivers/gpio/gpiolib-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 25b97109f97ea88c83c744e496e24263ee71b8bb..8bc4562608e1141983300132b90758ce68d7625d 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -753,7 +753,7 @@ int of_gpiochip_get_lflags(struct gpio_chip *chip,
 			   struct fwnode_reference_args *gpiospec,
 			   unsigned long *lflags)
 {
-	enum of_gpio_flags xlate_flags;
+	enum of_gpio_flags xlate_flags = 0;
 	struct of_phandle_args args;
 	struct gpio_desc *desc;
 

---
base-commit: 8b7179210b22f8e48a82c5ceacb9d56a9c4cfec4
change-id: 20261105-gpiolib-of-hog-uninitialized-0159fa4104df

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-06 14:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-05 13:37 [PATCH] gpio: of: fix potential misconfiguration of hogged lines Bartosz Golaszewski
2026-11-06 14:11 ` Mika Westerberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®