From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C48CBC352B6 for ; Thu, 7 Apr 2022 01:31:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242190AbiDGBcM (ORCPT ); Wed, 6 Apr 2022 21:32:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239461AbiDGBTQ (ORCPT ); Wed, 6 Apr 2022 21:19:16 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A7DE1A61FB; Wed, 6 Apr 2022 18:14:32 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 7BD6961DCE; Thu, 7 Apr 2022 01:14:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6734C385A6; Thu, 7 Apr 2022 01:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649294071; bh=bSlGXJ7/3lA0wX2uR7IlVzvv2YkAhOIcVEo/DSFBlLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sc38JcbaMOUwjXtBKVW/EDMnlF2/Z6Tnyq5j8bhWJ0rcwvCoRqwv0TX40Mmiq0tr3 snSaot5rnGOLb6f5qxu+GyN9AydK5isug2v49c2G1679esoZ0xS9gLAFnqo+n/TKOi 5MLBP4ybLi7kGiRCH+MVj2ep/6A3BQQC1jk0l8+afiHJgHZWTsYo5UMvU4CM3fnXb1 FHjCo4Q6tR8+Qk6oN2tL4gRZxwU9KLBOVw4z8YYA4oTJKYtlWrcmuO25PBncGj7FM3 LOYT3uIQ5viej8n5EQsJc0B4u0eAwLJohi6pZ1iDwDtXdIL8QvyjMwlqCXOrxtSjeA weeuzR5tc8ZKw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zheng Yongjun , Dmitry Torokhov , Sasha Levin , mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-input@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.10 07/25] Input: stmfts - fix reference leak in stmfts_input_open Date: Wed, 6 Apr 2022 21:13:55 -0400 Message-Id: <20220407011413.114662-7-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011413.114662-1-sashal@kernel.org> References: <20220407011413.114662-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit 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 9a64e1dbc04a..64b690a72d10 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0D8E1C433F5 for ; Thu, 7 Apr 2022 01:25:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hKGBiZEGN1uxe8Jr9miI1eINgjr5m1S4QMS9lEZ7mjI=; b=w0Pr+DLbk5UUbz olkMtHLW/+In+NOmIxpW1azA79nYuXgJ5cuPWIJCRFh0RCZiOEoEXaixhJzlpM8xpbmxVYe+eL/Dx o5E08iyL7zyvSlS6DytOgSRcpe+ejsI6uKp2rcS+Pq4n7G9w6LlKrblsLNtshIoNuiTp4wiumXqux jma6/PK0m9q2VuB/lYTvcmmdTKRDjFte/RXB62rPz8IdyTd+ZDfP+VlNJI/mdjbhr2H4CBuytz775 TAEG+zEIcPWP9RZekPTrZg545tDAJ97uIOoqLbf+gR2Sy31PGxlSF0/jksNfnuez1Cxc5bNL5lUnx IWPjC4jtRQHwZDrxA8/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncGsJ-008aiM-Pz; Thu, 07 Apr 2022 01:23:51 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ncGjI-008WBo-T2 for linux-arm-kernel@lists.infradead.org; Thu, 07 Apr 2022 01:14:34 +0000 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 dfw.source.kernel.org (Postfix) with ESMTPS id 7BD3661DCC; Thu, 7 Apr 2022 01:14:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B6734C385A6; Thu, 7 Apr 2022 01:14:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649294071; bh=bSlGXJ7/3lA0wX2uR7IlVzvv2YkAhOIcVEo/DSFBlLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sc38JcbaMOUwjXtBKVW/EDMnlF2/Z6Tnyq5j8bhWJ0rcwvCoRqwv0TX40Mmiq0tr3 snSaot5rnGOLb6f5qxu+GyN9AydK5isug2v49c2G1679esoZ0xS9gLAFnqo+n/TKOi 5MLBP4ybLi7kGiRCH+MVj2ep/6A3BQQC1jk0l8+afiHJgHZWTsYo5UMvU4CM3fnXb1 FHjCo4Q6tR8+Qk6oN2tL4gRZxwU9KLBOVw4z8YYA4oTJKYtlWrcmuO25PBncGj7FM3 LOYT3uIQ5viej8n5EQsJc0B4u0eAwLJohi6pZ1iDwDtXdIL8QvyjMwlqCXOrxtSjeA weeuzR5tc8ZKw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Zheng Yongjun , Dmitry Torokhov , Sasha Levin , mcoquelin.stm32@gmail.com, alexandre.torgue@foss.st.com, linux-input@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH AUTOSEL 5.10 07/25] Input: stmfts - fix reference leak in stmfts_input_open Date: Wed, 6 Apr 2022 21:13:55 -0400 Message-Id: <20220407011413.114662-7-sashal@kernel.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220407011413.114662-1-sashal@kernel.org> References: <20220407011413.114662-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220406_181433_009714_855F7731 X-CRM114-Status: GOOD ( 12.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 9a64e1dbc04a..64b690a72d10 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel