From: Kent Gibson <warthog618@gmail.com>
To: Bartosz Golaszewski <brgl@bgdev.pl>
Cc: "Linus Walleij" <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org,
"Bartosz Golaszewski" <bartosz.golaszewski@linaro.org>,
"José Guilherme de Castro Rodrigues"
<joseguilhermebh@hotmail.com>
Subject: Re: [libgpiod][PATCH v2] core: check for positive values returned by calls to ioctl()
Date: Thu, 25 Jan 2024 20:45:53 +0800 [thread overview]
Message-ID: <20240125124553.GA99216@rigel> (raw)
In-Reply-To: <20240125080629.21161-1-brgl@bgdev.pl>
On Thu, Jan 25, 2024 at 09:06:29AM +0100, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> If the kernel GPIO driver (erroneously) returns a positive value from one
> of its callbacks, it may end up being propagated to user space as
> a positive value returned by the call to ioctl(). Let's treat all
> non-zero values as errors as GPIO uAPI ioctl()s are not expected to ever
> return positive values.
>
> To that end let's create a wrapper around the libc's ioctl() that checks
> the return value and sets errno to EBADE (Invalid exchange) if it's
> greater than 0.
>
> This should be addressed in the kernel but will remain a problem on older
> or unpatched versions so we need to sanitize it in user-space too.
>
> Reported-by: José Guilherme de Castro Rodrigues <joseguilhermebh@hotmail.com>
> Fixes: b7ba732e6a93 ("treewide: libgpiod v2 implementation")
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Reviewed-by: Kent Gibson <warthog618@gmail.com>
prev parent reply other threads:[~2024-01-25 12:45 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-25 8:06 [libgpiod][PATCH v2] core: check for positive values returned by calls to ioctl() Bartosz Golaszewski
2024-01-25 12:45 ` Kent Gibson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240125124553.GA99216@rigel \
--to=warthog618@gmail.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=joseguilhermebh@hotmail.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.