linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/8] gpiolib: sanitize return values of callbacks
@ 2025-02-10 10:51 Bartosz Golaszewski
  2025-02-10 10:51 ` [PATCH 1/8] gpiolib: check the return value of gpio_chip::get_direction() Bartosz Golaszewski
                   ` (10 more replies)
  0 siblings, 11 replies; 25+ messages in thread
From: Bartosz Golaszewski @ 2025-02-10 10:51 UTC (permalink / raw)
  To: Linus Walleij, Bartosz Golaszewski
  Cc: linux-gpio, linux-kernel, Bartosz Golaszewski, stable

We've had instances of drivers returning invalid values from gpio_chip
calbacks. In several cases these return values would be propagated to
user-space and confuse programs that only expect 0 or negative errnos
from ioctl()s. Let's sanitize the return values of callbacks and make
sure we don't allow anyone see invalid ones.

The first patch checks the return values of get_direction() in kernel
where needed and is a backportable fix.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
Bartosz Golaszewski (8):
      gpiolib: check the return value of gpio_chip::get_direction()
      gpiolib: sanitize the return value of gpio_chip::request()
      gpiolib: sanitize the return value of gpio_chip::set_config()
      gpiolib: sanitize the return value of gpio_chip::get()
      gpiolib: sanitize the return value of gpio_chip::get_multiple()
      gpiolib: sanitize the return value of gpio_chip::direction_output()
      gpiolib: sanitize the return value of gpio_chip::direction_input()
      gpiolib: sanitize the return value of gpio_chip::get_direction()

 drivers/gpio/gpiolib.c      | 144 +++++++++++++++++++++++++++++++++++---------
 include/linux/gpio/driver.h |   6 +-
 2 files changed, 120 insertions(+), 30 deletions(-)
---
base-commit: a13f6e0f405ed0d3bcfd37c692c7d7fa3c052154
change-id: 20241212-gpio-sanitize-retvals-f5f4e0d6f57d

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>


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

end of thread, other threads:[~2025-02-25 14:49 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-10 10:51 [PATCH 0/8] gpiolib: sanitize return values of callbacks Bartosz Golaszewski
2025-02-10 10:51 ` [PATCH 1/8] gpiolib: check the return value of gpio_chip::get_direction() Bartosz Golaszewski
2025-02-19  2:42   ` Mark Brown
     [not found]   ` <CGME20250219083836eucas1p1b7ecc6e5fdc34d66ef7565bfcf399254@eucas1p1.samsung.com>
2025-02-19  8:38     ` Marek Szyprowski
2025-02-19  8:50       ` Bartosz Golaszewski
2025-02-19  9:13         ` Marek Szyprowski
2025-02-19  9:22           ` Bartosz Golaszewski
2025-02-25 13:19       ` Antonio Borneo
2025-02-10 10:51 ` [PATCH 2/8] gpiolib: sanitize the return value of gpio_chip::request() Bartosz Golaszewski
2025-02-10 10:51 ` [PATCH 3/8] gpiolib: sanitize the return value of gpio_chip::set_config() Bartosz Golaszewski
2025-02-10 10:51 ` [PATCH 4/8] gpiolib: sanitize the return value of gpio_chip::get() Bartosz Golaszewski
2025-02-24 16:30   ` Andy Shevchenko
2025-02-25 10:35     ` Bartosz Golaszewski
2025-02-10 10:51 ` [PATCH 5/8] gpiolib: sanitize the return value of gpio_chip::get_multiple() Bartosz Golaszewski
2025-02-10 10:52 ` [PATCH 6/8] gpiolib: sanitize the return value of gpio_chip::direction_output() Bartosz Golaszewski
2025-02-10 10:52 ` [PATCH 7/8] gpiolib: sanitize the return value of gpio_chip::direction_input() Bartosz Golaszewski
2025-02-10 10:52 ` [PATCH 8/8] gpiolib: sanitize the return value of gpio_chip::get_direction() Bartosz Golaszewski
2025-02-24 16:33   ` Andy Shevchenko
2025-02-24 19:55     ` Bartosz Golaszewski
2025-02-24 20:25       ` Andy Shevchenko
     [not found]   ` <CGME20250225101340eucas1p13c0c9cbc62ee7c9bfe964941c901bd1b@eucas1p1.samsung.com>
2025-02-25 10:13     ` Marek Szyprowski
2025-02-25 10:17       ` Bartosz Golaszewski
2025-02-14  9:21 ` [PATCH 0/8] gpiolib: sanitize return values of callbacks Linus Walleij
2025-02-17 10:51 ` (subset) " Bartosz Golaszewski
2025-02-24  9:05 ` Bartosz Golaszewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).