From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 215A3D512 for ; Mon, 12 Jun 2023 10:48:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A1BDEC433D2; Mon, 12 Jun 2023 10:48:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1686566901; bh=NfJUX6A0QiYwhq6oisopWTVpVaKccB7CwHd4GB4vL80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ynfjQKaTTSN9qaoev73na3WaNaCdiivt6DDG/MAlcEcNC0JPiIFcWgh992/BWS9lL sg21e9z4OyTFw2GTrg36o9j453z1VfUk4kEmk4S1TmpQ1nwMdU+Ib6oUrdqIMUkAU7 p/JUKQp6L2sdYz+q/rmvEnWwqOWAmbeYDFtVqiR0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Peter Hutterer , Dmitry Torokhov Subject: [PATCH 6.3 074/160] Input: fix open count when closing inhibited device Date: Mon, 12 Jun 2023 12:26:46 +0200 Message-ID: <20230612101718.412251775@linuxfoundation.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230612101715.129581706@linuxfoundation.org> References: <20230612101715.129581706@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Dmitry Torokhov commit 978134c4b192ed04ecf699be3e1b4d23b5d20457 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: a181616487db ("Input: Add "inhibited" property") Reviewed-by: Peter Hutterer Link: https://lore.kernel.org/r/ZFFz0xAdPNSL3PT7@google.com Cc: stable@vger.kernel.org Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- drivers/input/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -703,7 +703,7 @@ void input_close_device(struct input_han __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)