Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2105411ioo; Mon, 23 May 2022 10:10:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3yY5JPol22qkeJGjAOTr3wOnchs37hfRF/XRtvDfUHDW0X5y5xSryTPsVz1pCAuEPs1ej X-Received: by 2002:a63:2601:0:b0:3fa:3b85:11a6 with SMTP id m1-20020a632601000000b003fa3b8511a6mr6528039pgm.99.1653325820287; Mon, 23 May 2022 10:10:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653325820; cv=none; d=google.com; s=arc-20160816; b=BgiYykOQyK1iABQSAOY2Lp7RDrcrrgJg1UaUXrvX8Te3jAzBeRUTqct+KXprKn+dmY 3OASBbHFdSpuV10Q36Pyd59PCulTzHbVYbo4LeOMCX46k2V/M/6HUPmWb8sFkWmAsMBm 04C7dYtJ4Nxz3ZrD5apThRrIdkXgDFO6OSjoAEg3Gr+6gBJHyicO3IUP++ED59FjeLlC snRXGmHMUga+5/aEZoY3+P4YlUpFBlokEY8Y5fG1i/Iiqw/uV5muyhs6DhODIWs+UAJi 6texNMKdAChpCSY8FSpwOVa8pe/kfsPNz9QXoKezC45XoVnn+yqMXe8IS9j+xy7ApOhA y0Hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ci5budkWA/dw4CxZlsY+V1ZY8uHmSvya75+J92g8JR0=; b=UGY5K96ToRjp1lq1xmRiaNvhuQ1+0CqdXFRaAK4fTSZvmOhj/9NmLzrhD7QhsFeCQL VqoQ7zK4SJwnTdfZGEE2xYPUUOrAoGWiy2P9TmZA52+m9qY0lt/aSx8TRXFc1Szn/Rqw pVXvwZi1LlXsIeZ/I7htfd6ixNZ8HQ5jDc+XxQku4hpi7TlQ12jSUI4x2wDJBy6WogPD eoYGjgUlih9YBbbjd8Z8XjRN6+IEZATSaltZCEc8XHT5HLZPjPyH3vdbNgSp9/gkJPyw Yj+JiYxac4gMkruOCnKE9eM3/++sqI6g+9QGMmXw+2AkSe05NLiUGuG/Zu6ctBGDc+A8 H6dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZHEsn36X; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h24-20020a635758000000b003c631686abbsi10846036pgm.536.2022.05.23.10.10.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:10:20 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZHEsn36X; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4A4586C0CB; Mon, 23 May 2022 10:10:07 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239113AbiEWRJC (ORCPT + 99 others); Mon, 23 May 2022 13:09:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33196 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239562AbiEWRH6 (ORCPT ); Mon, 23 May 2022 13:07:58 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 400185BE5F; Mon, 23 May 2022 10:07:54 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A0A84B81201; Mon, 23 May 2022 17:07:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 06EC4C385A9; Mon, 23 May 2022 17:07:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325671; bh=0naOMxH3Ws/cN6Gr0znKiOXtUMhUhuBDe3no0f3cIO8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHEsn36XfNd1dCLzp9rC0Fmi1jVRcR0QBf0HA6qfGGsc8JdZAKBTgrc3MLT9Irfmy WmcB2SPHGkxAM4Bp2vgQBhyBIHvBb20eeSnu/OTVp6dSmIPuwRBkl4H4OBcHJA2+Kf 1AoCMhHRqkScm3/PoweB3oJG1uISRP+rN8Pbwh+M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zheng Yongjun , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.14 04/33] Input: stmfts - fix reference leak in stmfts_input_open Date: Mon, 23 May 2022 19:04:53 +0200 Message-Id: <20220523165747.818755611@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165746.957506211@linuxfoundation.org> References: <20220523165746.957506211@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 From: Zheng Yongjun [ Upstream commit 26623eea0da3476446909af96c980768df07bbd9 ] 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. Signed-off-by: Zheng Yongjun Link: https://lore.kernel.org/r/20220317131604.53538-1-zhengyongjun3@huawei.com Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin --- drivers/input/touchscreen/stmfts.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/input/touchscreen/stmfts.c b/drivers/input/touchscreen/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) err = pm_runtime_get_sync(&sdata->client->dev); if (err < 0) - return err; + goto out; err = i2c_smbus_write_byte(sdata->client, STMFTS_MS_MT_SENSE_ON); if (err) - return err; + goto out; mutex_lock(&sdata->mutex); sdata->running = true; @@ -371,7 +371,9 @@ static int stmfts_input_open(struct input_dev *dev) "failed to enable touchkey\n"); } - return 0; +out: + pm_runtime_put_noidle(&sdata->client->dev); + return err; } static void stmfts_input_close(struct input_dev *dev) -- 2.35.1