Skip to content

Commit

Permalink
Input: fix open count when closing inhibited device
Browse files Browse the repository at this point in the history
commit 978134c upstream.

Because the kernel increments device's open count in input_open_device()
even if device is inhibited, the counter should always be decremented in
input_close_device() to keep it balanced.

Fixes: a181616 ("Input: Add "inhibited" property")
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Link: https://lore.kernel.org/r/ZFFz0xAdPNSL3PT7@google.com
Cc: stable@vger.kernel.org
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
dtor authored and gregkh committed Jun 14, 2023
1 parent f9172a0 commit c8a46f3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ void input_close_device(struct input_handle *handle)

__input_release_device(handle);

if (!dev->inhibited && !--dev->users) {
if (!--dev->users && !dev->inhibited) {
if (dev->poller)
input_dev_poller_stop(dev->poller);
if (dev->close)
Expand Down

0 comments on commit c8a46f3

Please sign in to comment.