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 13:52:21 +0000 [thread overview]
Message-ID: <20260828135221.DCA0D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260828134149.128160-1-jeffinphilip14@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Double-lock self-deadlock on `atkbd->mutex` in `atkbd_enable` and `atkbd_disable` when called from `atkbd_reconnect` and `atkbd_attr_set_helper`.
--
commit 590703593bcdcff9b9b0f25df1465a3e3cd68c7e
Author: Jeffin Philip <jeffinphilip14@gmail.com>
KASAN: slab-use-after-free Read in atkbd_set_repeat_rate
This commit adds mutex guards in atkbd_enable() and atkbd_disable() to
presumably protect against concurrent access.
> diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
> index 3509b58e64920..f7c71278ecaa4 100644
> --- a/drivers/input/keyboard/atkbd.c
> +++ b/drivers/input/keyboard/atkbd.c
> @@ -694,6 +694,7 @@ static int atkbd_event(struct input_dev *dev,
>
> static inline void atkbd_enable(struct atkbd *atkbd)
> {
> + guard(mutex)(&atkbd->mutex);
> guard(serio_pause_rx)(atkbd->ps2dev.serio);
>
> atkbd->enabled = true;
> @@ -706,6 +707,7 @@ static inline void atkbd_enable(struct atkbd *atkbd)
>
> static inline void atkbd_disable(struct atkbd *atkbd)
> {
> + guard(mutex)(&atkbd->mutex);
[Severity: High]
Does this code cause a self-deadlock when called from paths that already
hold atkbd->mutex?
For example, when the system resumes and atkbd_reconnect() is called, the
mutex is acquired right before calling atkbd_disable():
drivers/input/keyboard/atkbd.c:atkbd_reconnect() {
...
guard(mutex)(&atkbd->mutex);
atkbd_disable(atkbd);
...
}
Similarly, writing to a sysfs attribute triggers atkbd_attr_set_helper(),
which acquires the lock before calling both atkbd_disable() and
atkbd_enable():
drivers/input/keyboard/atkbd.c:atkbd_attr_set_helper() {
...
scoped_guard(mutex_intr, &atkbd->mutex) {
atkbd_disable(atkbd);
retval = handler(atkbd, buf, count);
atkbd_enable(atkbd);
...
}
Since struct mutex is not recursive, attempting to acquire an already-held
mutex here will cause the thread to hang.
> guard(serio_pause_rx)(atkbd->ps2dev.serio);
>
> atkbd->enabled = false;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260828134149.128160-1-jeffinphilip14@gmail.com?part=1
next prev parent reply other threads:[~2026-08-28 13:52 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 [this message]
2026-08-28 14:06 ` syzbot
2026-08-28 14:03 ` Jeffin Philip
2026-08-28 14:15 ` sashiko-bot
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=20260828135221.DCA0D1F000E9@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.