diff options
author | 2025-02-10 11:51:56 +0100 | |
---|---|---|
committer | 2025-02-24 09:58:58 +0100 | |
commit | 69920338f8130da929ade6f93e6fa3e0e68433ee (patch) | |
tree | 2756984d79627a1b8b7172a79c21d79d1d56efe6 /include/linux/gpio | |
parent | Merge tag 'v6.14-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into HEAD (diff) | |
download | wireguard-linux-69920338f8130da929ade6f93e6fa3e0e68433ee.tar.xz wireguard-linux-69920338f8130da929ade6f93e6fa3e0e68433ee.zip |
gpiolib: sanitize the return value of gpio_chip::request()
The return value of the request() callback may be propagated to
user-space. If a bad driver returns a positive number, it may confuse
user programs. Tighten the API contract and check for positive numbers
returned by GPIO controllers.
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20250210-gpio-sanitize-retvals-v1-2-12ea88506cb2@linaro.org
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'include/linux/gpio')
-rw-r--r-- | include/linux/gpio/driver.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/include/linux/gpio/driver.h b/include/linux/gpio/driver.h index 10544f4a03e5..ce22c072337c 100644 --- a/include/linux/gpio/driver.h +++ b/include/linux/gpio/driver.h @@ -329,7 +329,8 @@ struct gpio_irq_chip { * @fwnode: optional fwnode providing this controller's properties * @owner: helps prevent removal of modules exporting active GPIOs * @request: optional hook for chip-specific activation, such as - * enabling module power and clock; may sleep + * enabling module power and clock; may sleep; must return 0 on success + * or negative error number on failure * @free: optional hook for chip-specific deactivation, such as * disabling module power and clock; may sleep * @get_direction: returns direction for signal "offset", 0=out, 1=in, |