From: Philippe Gerum <rpm@xenomai.org>
To: "Martínek Petr" <petr.martinek@elvac.eu>
Cc: "xenomai@lists.linux.dev" <xenomai@lists.linux.dev>
Subject: Re: linux-evl 7.2 OOB GPIO NULL dereference in lineevent_create
Date: Thu, 12 Nov 2026 15:20:13 +0100 [thread overview]
Message-ID: <87wlqiyvvm.fsf@xenomai.org> (raw)
In-Reply-To: <c67e81ec3fa44745b6c5c13c87fab81b@elvac.eu> ("Martínek Petr"'s message of "Wed, 11 Nov 2026 11:53:20 +0000")
Martínek Petr <petr.martinek@elvac.eu> writes:
> In lineevent_create le->oob_state is used after retain_and_null_ptr(le)
> which set le to NULL. Included patch adds oob_state variable
> to fix this.
>
> Signed-off-by: Petr Martínek <petr.martinek@elvac.eu>
> ---
> diff -Naur a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
> --- a/drivers/gpio/gpiolib-cdev.c 2026-09-23 08:39:20.000000000 +0200
> +++ b/drivers/gpio/gpiolib-cdev.c 2026-11-11 10:25:07.714465106 +0100
> @@ -2222,6 +2222,7 @@
> {
> struct gpioevent_request eventreq;
> struct lineevent_state *le __free(lineevent_free) = NULL;
> + struct lineevent_oob_state* oob_state;
> struct gpio_desc *desc;
> u32 offset;
> u32 lflags;
> @@ -2340,10 +2341,12 @@
> O_RDONLY | O_CLOEXEC));
> if (fdf.err)
> return fdf.err;
> +
> + oob_state = &le->oob_state;
> retain_and_null_ptr(le);
>
> if (oob_handling_requested(lflags)) {
> - ret = evl_open_file(&le->oob_state.efile, fd_prepare_file(fdf));
> + ret = evl_open_file(&oob_state->efile, fd_prepare_file(fdf));
> if (ret)
> return ret;
> }
> @@ -2351,7 +2354,7 @@
> eventreq.fd = fd_prepare_fd(fdf);
> if (copy_to_user(ip, &eventreq, sizeof(eventreq))) {
> if (oob_handling_requested(lflags))
> - evl_release_file(&le->oob_state.efile);
> + evl_release_file(&oob_state->efile);
> return -EFAULT;
> }
>
Merged, thanks.
--
Philippe.
prev parent reply other threads:[~2026-11-12 14:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 7:06 linux-evl 7.2 compilation without SMP Martínek Petr
2026-11-11 9:11 ` Philippe Gerum
2026-11-11 11:53 ` linux-evl 7.2 OOB GPIO NULL dereference in lineevent_create Martínek Petr
2026-11-12 14:20 ` Philippe Gerum [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=87wlqiyvvm.fsf@xenomai.org \
--to=rpm@xenomai.org \
--cc=petr.martinek@elvac.eu \
--cc=xenomai@lists.linux.dev \
/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.