Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7378951rwr; Tue, 2 May 2023 13:53:56 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7SPvoCacpdXrthT13sE9RuuKLcUheu8WhvlsAr6yH/fOVTr2rBLhlxPrJUU0hW7tBS5b0t X-Received: by 2002:a17:90a:f481:b0:23d:bbcb:c97f with SMTP id bx1-20020a17090af48100b0023dbbcbc97fmr19006964pjb.1.1683060836154; Tue, 02 May 2023 13:53:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683060836; cv=none; d=google.com; s=arc-20160816; b=djkhufgb4avaWtC9R/tzD1506pGFxYcJr5C6K3uxCXHM2qycDWpbwl9vFtknP1Pi4d VIEXGiM4XMhVfukCBPrwWz+WmJ/QGoIjcBgfcqrhsOwG+FCP2OxLlswYzxxAz0bi99pN 6dCKU3ZN8B7WlYhEwZldQgT0bDjnYkflqbTiSOrtcXEkr2CwB8gkewKst+V4Ufsad1jV zpkfNg7za4IJ1HAdyRDSxf02sZcUsh5R2xeRM0rjE+G/WK7WQ00Bja38gTGzNv6Xk0Nz gTi7NGhLxm2PhtakuQw9KC8IRpLyoCIyGIxxj0xBdDcd5+7G7m272IABnBxoiaFN1r/9 dt+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=KQ3mjNB18PJwmZ+twuLFKpTCTV95U8I5JkqBE5yVBMg=; b=VS0vjN6Mhunvd0hM/C3+CU4V9U3ebFrGCMawUlrhOr4UD0c2r3QARtzkdtSFgSa+iY myj5PnfDUmJUDaTCzU/VnfnfvFk/ZPRzsdelS8ubKjvMHJT5ksY9ySbCeOfPHVw77+D6 BfdUDEpiN9QaThYDzhjeSq4yMRGZ8W04qzm3lIXsQ5TtsDkMWKxsV8ZYIPiiZ4t7zEkj L5znWUm1l5C/KrvClpSwWQRcnqWhQreB9TxnB4Q7jpWst6Lki2en5ykWtGAvOcs8UCn5 eNDEXu8ylsX2pqE0rBw9U/LgYbLtUVIXlarzrsKWDyBW+Bz3oa3IXFRWPQcLUrjb2JQR uKfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="O/xM7pix"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ie2-20020a17090b400200b002472cd8ded6si31226758pjb.103.2023.05.02.13.53.42; Tue, 02 May 2023 13:53:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="O/xM7pix"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229864AbjEBUee (ORCPT + 99 others); Tue, 2 May 2023 16:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59074 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229506AbjEBUed (ORCPT ); Tue, 2 May 2023 16:34:33 -0400 Received: from mail-pf1-x42a.google.com (mail-pf1-x42a.google.com [IPv6:2607:f8b0:4864:20::42a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1A1E41997; Tue, 2 May 2023 13:34:32 -0700 (PDT) Received: by mail-pf1-x42a.google.com with SMTP id d2e1a72fcca58-63b5c830d5eso3077573b3a.2; Tue, 02 May 2023 13:34:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683059671; x=1685651671; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=KQ3mjNB18PJwmZ+twuLFKpTCTV95U8I5JkqBE5yVBMg=; b=O/xM7pixRfF3HafraVk7nXYz/EE1YDhNpopV/fr89Rz4GEAu1dce4tmBZtNShCvyMY WvDcGCFtQz7Yxs0dNBvbyEoxZDRNKrNB0qJ5ZBc+2ZXr6SWEO6GI9N3H9TQVvxPLF6hX hYwvgl5Chq1+Hn5yHFEuJoYtHUw3w1XnKrVIhQi5xBoLUfAV/61zSjhI5WJ0lHRLt79B 6VRbwkmu13cOxekg2n88TCmG7zma36whMBI7ZWE2aORQrifva3iK1k2hrcvLaOfLpRhA vP7XiXK0YYi/YRWw9exMIImsGe3vnA1anbX+ZDx9DvxJoGmvxyokwdaNe2GDwvwdK4T2 H5Yw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683059671; x=1685651671; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=KQ3mjNB18PJwmZ+twuLFKpTCTV95U8I5JkqBE5yVBMg=; b=bjKFMjpQcQ5/qLRfZHPiBCey1kKx98LD5Y35tnPhGpqdMR/c8CA86B758bRbPCDfFN lzisK5lwOkYUVeORmaxR+KdJ6vTg16PCeluwW7gtosoSGQEgBIl+IvHwZ5Hb89jxBG/D arzXPb9JMXLD7OO1WaA2wdZrXfNTxr1R1+WrL4tCgKjxeWoaKA8BYzhpVHfTgm/YzIAj 24K1tRU8fo4cZCyQ6fOvo8MFuWeB9G9GmsOoRrzcNoNvWXnLE5bMqfkoCqaJJ4qJSB33 xSIu2bIJRBKd9o9LCo2tiyjOE4+emRPOxrb5JagjLyrLXBthfR1pe0AScDEjECYTccUo YAQQ== X-Gm-Message-State: AC+VfDxvV1lQ/0Ul321CTWnK8MBNDzBrga14TFJmiSqjY1qvzTHWk60/ xdCK1zOQgbC4V0hrPSWKQLU0/kymNAk= X-Received: by 2002:a05:6a21:168c:b0:f2:be63:23ed with SMTP id np12-20020a056a21168c00b000f2be6323edmr20181013pzb.35.1683059670531; Tue, 02 May 2023 13:34:30 -0700 (PDT) Received: from google.com ([2620:15c:9d:2:6edf:1ae0:55be:72db]) by smtp.gmail.com with ESMTPSA id z21-20020a62d115000000b0063d24fcc2b7sm22180639pfg.1.2023.05.02.13.34.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 13:34:29 -0700 (PDT) Date: Tue, 2 May 2023 13:34:27 -0700 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Peter Hutterer Subject: [PATCH] Input: fix open count when closing inhibited device Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,FSL_HELO_FAKE, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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") Signed-off-by: Dmitry Torokhov --- drivers/input/input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index f791d14ecf23..8c5fdb0f858a 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -705,7 +705,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) -- 2.40.1.495.gc816e09b53d-goog -- Dmitry