Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2402554ioo; Sat, 28 May 2022 12:30:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzwjEGSQlhQgNfxB19G8YlnzByLpZkwjirdf1Yy4NWrPTd5LCiyznYQC4XD5RJX6AutKnGF X-Received: by 2002:a17:90b:4f47:b0:1df:ef58:d055 with SMTP id pj7-20020a17090b4f4700b001dfef58d055mr14554784pjb.82.1653766209775; Sat, 28 May 2022 12:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653766209; cv=none; d=google.com; s=arc-20160816; b=CASQBcZcDg1upMFXdxoUq07SoT8EnmFBT8mPEYsuP3rZvWdL7PmOimZvFzvDyx6lTw w2ssIZukPx4Mcc+4JH5aUux0supK+vUPI/IGQ1315rE1moO2pTE6nzYKsMLGPYnI9abs 8NgqiBhQY+3enMhwcxAuahsRFquTuDxpbjWzdWIoLPKgmKpRQMwI/BK+vje95L1W+zZq 4B7Ey2IQyDmnESS3nVDmauJXXFU7DpfyuBOIPbXqiX83InOHF4U9yTACLZFuEbpbFur2 9T7AlMKTQ76mvQk1aeWtk01OBP57UF14qkYVwOQAwGmNIvmXMYDzvtDTBwcpSgTeVK/0 GPJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=gpsESLcyFBFg76SUu2pV+EgVRC0ZXGIH/s2jtfSW2wM=; b=KOs/TQteg0WVMvW4YHz6z2kvZ5R4bV92ED17vUVzWEcGHmpzKqy/xP1jtPi0u7sg1i PQvTT/noiebNxkk5hr6kV/HRAlNK5Rr06Ki2bvip4zwH637EgOB1rTnQThWGROYd90CW GqbNY6dtAAJgPB4NVpUB9m1nXaW6camsAtRXFkJZYdEzcRP1SmcgUiSGcfjLQeC6nLOE w400Zis6ZK4GzmnTNE6AHTxijBmi2gZTj8/D+1N/R49C02+EJH9HayO7bCCVxi/77qcb yfjnov/K2J2FS7UwL/PXaUsMDJ2bmIgyJ8shpoNVwnNokVXO3CRlvP4PBEH8E1yn7iS2 Ta+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x190-20020a6363c7000000b003f6382e04edsi10568677pgb.340.2022.05.28.12.30.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 12:30:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A0DF5369C2; Sat, 28 May 2022 11:58:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237393AbiEYKxA (ORCPT + 99 others); Wed, 25 May 2022 06:53:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234607AbiEYKwx (ORCPT ); Wed, 25 May 2022 06:52:53 -0400 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90CCCB1F9; Wed, 25 May 2022 03:52:50 -0700 (PDT) Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 522771C0B92; Wed, 25 May 2022 12:52:49 +0200 (CEST) Date: Wed, 25 May 2022 12:52:48 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Zheng Yongjun , Dmitry Torokhov , Sasha Levin Subject: Re: [PATCH 4.14 04/33] Input: stmfts - fix reference leak in stmfts_input_open Message-ID: <20220525105248.GA31002@duo.ucw.cz> References: <20220523165746.957506211@linuxfoundation.org> <20220523165747.818755611@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="J2SCkAp4GZ/dPZZf" Content-Disposition: inline In-Reply-To: <20220523165747.818755611@linuxfoundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 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 --J2SCkAp4GZ/dPZZf Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Zheng Yongjun >=20 > [ Upstream commit 26623eea0da3476446909af96c980768df07bbd9 ] >=20 > pm_runtime_get_sync() will increment pm usage counter even it > failed. Forgetting to call pm_runtime_put_noidle will result > in reference leak in stmfts_input_open, so we should fix it. This is wrong, AFAICT. > drivers/input/touchscreen/stmfts.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) >=20 > diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscre= en/stmfts.c > index d9e93dabbca2..9007027a7ad9 100644 > --- a/drivers/input/touchscreen/stmfts.c > +++ b/drivers/input/touchscreen/stmfts.c > @@ -344,11 +344,11 @@ static int stmfts_input_open(struct input_dev *dev) > =20 > err =3D pm_runtime_get_sync(&sdata->client->dev); > if (err < 0) > - return err; > + goto out; > =20 > err =3D i2c_smbus_write_byte(sdata->client, STMFTS_MS_MT_SENSE_ON); > if (err) > - return err; > + goto out; > =20 > mutex_lock(&sdata->mutex); > sdata->running =3D true; > @@ -371,7 +371,9 @@ static int stmfts_input_open(struct input_dev *dev) > "failed to enable touchkey\n"); > } > =20 > - return 0; > +out: > + pm_runtime_put_noidle(&sdata->client->dev); > + return err; > } > =20 > static void stmfts_input_close(struct input_dev *dev) We are now doing put even on the success path. That will break the device... and will result in non-functional device and double put due to the close path. Best regards, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --J2SCkAp4GZ/dPZZf Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCYo4KgAAKCRAw5/Bqldv6 8pnsAJ9QdlVNWhX78VODohF0ft2PRzO4bQCcCOhk6eraaxF95Mfm0sF5y6IXBl0= =bLvk -----END PGP SIGNATURE----- --J2SCkAp4GZ/dPZZf--