diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2025-02-28 16:03:47 +0300 |
---|---|---|
committer | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2025-02-28 18:30:48 +0300 |
commit | 64407f4b5807dc9dec8135e1bfd45d2cb11b4ea0 (patch) | |
tree | 1602b857ce5915e22ef745a009022e6a9e6fb1bb /lib/zstd/common/zstd_common.c | |
parent | d082ecbc71e9e0bf49883ee4afd435a77a5101b6 (diff) | |
download | linux-64407f4b5807dc9dec8135e1bfd45d2cb11b4ea0.tar.xz |
gpiolib: Fix Oops in gpiod_direction_input_nonotify()
The gpiod_direction_input_nonotify() function is supposed to return zero
if the direction for the pin is input. But instead it accidentally
returns GPIO_LINE_DIRECTION_IN (1) which will be cast into an ERR_PTR()
in gpiochip_request_own_desc(). The callers dereference it and it leads
to a crash.
I changed gpiod_direction_output_raw_commit() just for consistency but
returning GPIO_LINE_DIRECTION_OUT (0) is fine.
Cc: stable@vger.kernel.org
Fixes: 9d846b1aebbe ("gpiolib: check the return value of gpio_chip::get_direction()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Link: https://lore.kernel.org/r/254f3925-3015-4c9d-aac5-bb9b4b2cd2c5@stanley.mountain
[Bartosz: moved the variable declarations to the top of the functions]
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'lib/zstd/common/zstd_common.c')
0 files changed, 0 insertions, 0 deletions