From: sashiko-bot@kernel.org
To: "Jeffin Philip" <jeffinphilip14@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [syzbot] [input?] KASAN: slab-use-after-free Read in atkbd_set_repeat_rate
Date: Fri, 28 Aug 2026 14:15:50 +0000 [thread overview]
Message-ID: <20260828141551.232281F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828140330.134760-1-jeffinphilip14@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Using an interruptible lock guard (`scoped_guard(mutex_intr)`) in a teardown path conditionally skips the device disable logic if a signal is pending, resulting in a Use-After-Free of `atkbd->dev`.
--
commit bc5cff19d061e401dc02c7bcc7660c6bf6781f46
Author: Jeffin Philip <jeffinphilip14@gmail.com>
KASAN: slab-use-after-free Read in atkbd_set_repeat_rate
This commit attempts to fix a use-after-free issue by wrapping the
device disable routine in atkbd_disconnect with a mutex guard to serialize
teardown against other event and attribute operations.
> diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
> index 3509b58e64920..d5b564bab0e20 100644
> --- a/drivers/input/keyboard/atkbd.c
> +++ b/drivers/input/keyboard/atkbd.c
> @@ -961,7 +961,9 @@ static void atkbd_disconnect(struct serio *serio)
> {
> struct atkbd *atkbd = atkbd_from_serio(serio);
>
> + scoped_guard(mutex_intr, &atkbd->mutex) {
> atkbd_disable(atkbd);
> + }
[Severity: High]
If a signal is pending when atkbd_disconnect() is called, will this scoped
guard silently skip the hardware disable block?
Because mutex_intr is interruptible, it returns -EINTR if the process
receives a signal (such as when userspace sends a signal to the unbind
process). This causes the guarded scope block to be bypassed, meaning
atkbd_disable() is not executed and atkbd->enabled remains true.
When input_unregister_device() subsequently frees the device, could
concurrent handlers that rely on the enabled flag still execute and trigger
a use-after-free on the freed dev pointer?
For example, in atkbd_receive_byte():
if (!atkbd->enabled)
return;
input_event(dev, EV_MSC, MSC_RAW, code);
And similarly in atkbd_event_work():
if (test_and_clear_bit(ATKBD_REP_EVENT_BIT, &atkbd->event_mask))
atkbd_set_repeat_rate(atkbd);
Should this use an uninterruptible guard instead, since disabling the device
is a mandatory step during teardown?
>
> input_unregister_device(atkbd->dev);
>
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260828140330.134760-1-jeffinphilip14@gmail.com?part=1
next prev parent reply other threads:[~2026-08-28 14:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 0:44 [syzbot] [input?] KASAN: slab-use-after-free Read in atkbd_set_repeat_rate syzbot
2026-08-28 11:42 ` syzbot
2026-08-28 12:54 ` Jeffin Philip
2026-08-28 13:03 ` syzbot
2026-08-28 13:13 ` sashiko-bot
2026-08-28 13:41 ` Jeffin Philip
2026-08-28 13:52 ` sashiko-bot
2026-08-28 14:06 ` syzbot
2026-08-28 14:03 ` Jeffin Philip
2026-08-28 14:15 ` sashiko-bot [this message]
2026-08-28 14:20 ` syzbot
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=20260828141551.232281F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=jeffinphilip14@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@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.