Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3689136lfo; Mon, 23 May 2022 11:30:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxk3/lQjvfS8m3OgWKW+V3e7kc+kO8Lpb09rp2q6rQuoq7JLRqwi8trnq31VOxiDFLpo3Ay X-Received: by 2002:a17:90a:5908:b0:1df:1232:d47c with SMTP id k8-20020a17090a590800b001df1232d47cmr318469pji.5.1653330650415; Mon, 23 May 2022 11:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653330650; cv=none; d=google.com; s=arc-20160816; b=dF8+eJIEiG/DqIyXafQTj1Yco029i8CsikBRcMUwQk7Dw877FlDX/daQuHcvF1yHBY qoMy2MDWjDDjzsIdSZ53OcGa75Ls6XxUqTKUrj9MQnLsm6c8MBFo+atPi5+HYrFd29Zf jEpnYhq01Vu8k5mOPPoMGltlibNHAwYt4b/N4Wxty1ABUXY+aXF/57QG8VKYb2CmAe/d r4OZASKyybR9QrrEhXTlmJcVS1ILnnX2a0k25KdNewgjCapc8pcaiLInH//IMI0BW+I3 EH6Hagdfg6PDw8xDpHsoMfXDMMge8fHl5tpGBIKJIBXa2lkeF6s9cY35AsxU+9+sQvZP wFwQ== 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=mUO46lXU6TvymE/Drd1neeji0PsWE9VNmKw/Ml0YB+ofaoWsOdHKFp5Qa7i6Rvaldi 3N8fYMCVIorALHLUVbr1ij02DT/tT2GZEFc4ptu73fUSewR4IVhRgqvYu7iAuH58tIC8 oGWM4TxTeuh8cPwrHJR4Nq45QdeYcqQKGMhgabXdkCeFan+4iZUEsz/8l6n1QuD19d+3 j+RIkmMwGZzbID2E3jOxBk/lvqIffWCbobma8azD9tw0l2fkJh3fsx3MvdJNjHRpX+Bl 3VIHJoai4j8UUTzhrBPFPGhLu3v5hDxSDNnvBqWAU2BwVCZcWGqigqIR8JrS8HnuwTrr DPiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ulLPzRnM; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z16-20020aa78890000000b00518c539ce57si39243pfe.303.2022.05.23.11.30.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 11:30:50 -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; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ulLPzRnM; 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; 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 7829913F902; Mon, 23 May 2022 11:30:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240252AbiEWRLw (ORCPT + 99 others); Mon, 23 May 2022 13:11:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239136AbiEWRK2 (ORCPT ); Mon, 23 May 2022 13:10:28 -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 8E6F76CF74; Mon, 23 May 2022 10:09:57 -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 7A026614F4; Mon, 23 May 2022 17:09:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60897C385AA; Mon, 23 May 2022 17:09:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325789; bh=KuFUgf9ktp4busrSOKUHZR6BbW7z2IoxN0dCsE+i6NY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ulLPzRnMQ4yQ/MXvuNHftBKxdnJMC+wzX0Slb49jQlIYrVRSciXZhxWtC+lgFqvGZ +lf7rrhgdtfP667fScg5IlvL6HxB7V2TSEdpzZRUWbohGad+MSrJyi+H/14ChmVeoU KOmQsMgEGOgIaDyWk7zv8rdBtaZR7uLCP6beV2ew= 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.19 04/44] Input: stmfts - fix reference leak in stmfts_input_open Date: Mon, 23 May 2022 19:04:48 +0200 Message-Id: <20220523165754.223999686@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165752.797318097@linuxfoundation.org> References: <20220523165752.797318097@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