Re: [PATCH 0/8] gpiolib: sanitize return values of callbacks
From: Linus Walleij
Date: Fri Feb 14 2025 - 04:21:20 EST
On Mon, Feb 10, 2025 at 11:52 AM Bartosz Golaszewski <brgl@xxxxxxxx> wrote:
> 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@xxxxxxxxxx>
This seems reasonable.
Reviewed-by: Linus Walleij <linus.walleij@xxxxxxxxxx>
Yours,
Linus Walleij