Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2112403ioo; Mon, 23 May 2022 10:18:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+jf9IrgEzB9Lp83NiAMAzYWaulfi+C+yzU1iYSp++F9hY9wzSiCTyQl0RDLZIA6UBgPdx X-Received: by 2002:a17:902:ab8b:b0:160:df9e:99fa with SMTP id f11-20020a170902ab8b00b00160df9e99famr23318856plr.108.1653326325381; Mon, 23 May 2022 10:18:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326325; cv=none; d=google.com; s=arc-20160816; b=sUZCauoP4ArWJCtX8h9YcteMnTPHYlXsDVRytxteBRQkb1Zl9o+bW6Nu11MEU3Rt1X VNnqPjm57eOSLfAz7flwB6zpUJty2goF0qFHZUURHR3D/7YZWjTYMkL0QjBswJFIwpAX Acoo1l8mTYOF3cO9NTcN48ZKLwELrYVffX/KC0jM6WaLO/ntXwpYBPfhveIgfkKrAK9z CIpmyz6/zYmaDwAvU5seuIqYpUPOZU0bef8K0viwU6t60b8smAIJloXMaf+R9wRiCHn7 ijN3q5QWcmqpOpyiGUWi7qJcFDX5iPeHp758S+cvhFj7EYrF3BUSJJHfkkCVz2cbf68i VA6w== 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=jvmp4xwBF02pgMMYQrbxDnMSpFxv2SQP2gDiEQh5Ubs=; b=RfazG3UU+Tfz3MhUj0OyWNxIfP88ayN+WDyA3uSL9qnYvhEpYztWWd55UlaojIY/Fp whm1O7DsflN3USyZP1PMdDL5hOkRBvD1pbe/KvlMJNEXTB3artnkbeID8D9cmT++/cm/ DN8jBjHQID75HGpjXwtIELw+KCCcxn3AmVJLdr6wo7q/w66ai62wflmp7J/RzSOK0iHk BZuLP0gvBq64LqiV/2eVt0xK30usq+BeitoFIxf/wIQlZMmSO7od0C6eYzk5aiN7hOVN ZeohMD3KZ4Ci1I8p1eommOHplWGekjOAwuK5Gvl2SMlyIFfV2+FCS1Kc5F+icBcfYN/0 YIQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UqGGoRJf; 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 n15-20020a170902f60f00b0015ea43982d0si11794901plg.129.2022.05.23.10.18.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:18:45 -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=UqGGoRJf; 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 607E377F39; Mon, 23 May 2022 10:18:30 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240882AbiEWRQq (ORCPT + 99 others); Mon, 23 May 2022 13:16:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37832 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239649AbiEWRMp (ORCPT ); Mon, 23 May 2022 13:12:45 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E68456C544; Mon, 23 May 2022 10:12:12 -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 751D3B81212; Mon, 23 May 2022 17:11:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB99BC385A9; Mon, 23 May 2022 17:11:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325905; bh=KuFUgf9ktp4busrSOKUHZR6BbW7z2IoxN0dCsE+i6NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UqGGoRJf0oSbzY4ANHcEPD6uBK0Y2ZfUK5kmOQTuDVQt979AevrY/ZgE1iuFOoY6g Y4+qdoWSy6fImoo0O/uavUMFkcvGdvxmfD1jEdyymzxafnGx5t2/F3oYoxThEuenuA Y8N/Mvzly6XaEE+zDzGlXyo9UhvEACQF9T2Krfkw= 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 5.4 07/68] Input: stmfts - fix reference leak in stmfts_input_open Date: Mon, 23 May 2022 19:04:34 +0200 Message-Id: <20220523165803.771385895@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165802.500642349@linuxfoundation.org> References: <20220523165802.500642349@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 cd8805d71d97..be1dd504d5b1 100644 --- a/drivers/input/touchscreen/stmfts.c +++ b/drivers/input/touchscreen/stmfts.c @@ -339,11 +339,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; @@ -366,7 +366,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