All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v2 2/4] Input: clear inhibited flag before re-opening device on uninhibit
Date: Mon, 03 Aug 2026 01:18:32 +0000	[thread overview]
Message-ID: <20260803011832.A000D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260803005210.1251102-2-dmitry.torokhov@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] When `dev->open()` fails during uninhibiting, restoring `dev->inhibited = true` without holding `dev->event_lock` and without releasing active keys leaves events permanently stuck in userspace.
--

--- Patch [2]: [PATCH v2 2/4] Input: clear inhibited flag before re-opening device on uninhibit ---
commit f055731a6a02bc8698a040a5af7e51e9039340a7
Author: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Input: clear inhibited flag before re-opening device on uninhibit

This patch clears dev->inhibited before calling dev->open() when
uninhibiting a device. It ensures initial events are delivered to handlers,
and restores dev->inhibited if dev->open() fails.

> diff --git a/drivers/input/input.c b/drivers/input/input.c
> --- a/drivers/input/input.c
> +++ b/drivers/input/input.c
> @@ -1813,24 +1813,26 @@ static int input_uninhibit_device(struct input_dev *dev)
>  	if (!dev->inhibited)
>  		return 0;
>  
> +	dev->inhibited = false;
> +
>  	if (dev->users) {
>  		if (dev->open) {
>  			error = dev->open(dev);
> -			if (error)
> +			if (error) {
> +				dev->inhibited = true;

[Severity: Medium]
When dev->open() fails and dev->inhibited is restored to true, is there a
potential data race with concurrent input_handle_event() readers?

Since dev->inhibited was set to false earlier, the driver's open() method or
interrupts could have emitted events before the failure. Does restoring
dev->inhibited here without holding dev->event_lock and without synthesizing
key releases via input_dev_release_keys() risk leaving events permanently
stuck in userspace?

>  				return error;
> +			}
>  		}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260803005210.1251102-1-dmitry.torokhov@gmail.com?part=2

  reply	other threads:[~2026-08-03  1:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  0:52 [PATCH v2 1/4] Input: ensure device is ready before delivering events Dmitry Torokhov
2026-08-03  0:52 ` [PATCH v2 2/4] Input: clear inhibited flag before re-opening device on uninhibit Dmitry Torokhov
2026-08-03  1:18   ` sashiko-bot [this message]
2026-08-03  2:08     ` Dmitry Torokhov
2026-08-03  0:52 ` [PATCH v2 3/4] Input: call handler->start() when uninhibiting device Dmitry Torokhov
2026-08-03  1:27   ` sashiko-bot
2026-08-03  0:52 ` [PATCH v2 4/4] Input: defer handler's start() until device is opened Dmitry Torokhov

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=20260803011832.A000D1F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=dmitry.torokhov@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.