Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1878899pxk; Tue, 1 Sep 2020 09:52:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxtvqMPSjXNTIk04eZ0iubcoe4EUdOqFlLoYhIrkb65/yf24A9HHXm5Zjsgv47GRyWB7T6u X-Received: by 2002:a50:f687:: with SMTP id d7mr2637067edn.353.1598979136877; Tue, 01 Sep 2020 09:52:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598979136; cv=none; d=google.com; s=arc-20160816; b=zN//jVeddciUPtYhkhKxgx2w/rY+4VBc3T6ioMLTMB1RVzOVR5Q/a0RB/3jJNjmhj7 xQPbHOgHMdFAhtNM8mRSCfFABN+KXBbevn7BiD60NzSdGbcgizfxRuEqvCNlMMcThE7Q ITnDh7pNw+GSXm2bVpdfY5Sz2R8h8VD8g41l/9uAgtodTRhw++Q4THh4WFut9P8NV3Sn WiMk8KXGUX0WfVlZVYy4CX5uBZ83uh/5VoTz8iPkb9QNrMjHLYRidp0dRNcC5MgGJSH1 tvJ9EC+5TUmRsO0CkKk8fePhMtjHZJxAJdq+cZm684MHNprOnYaLb3gxipfaezVltQQL RS9g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=d5rgErXOdieeFPJ97dcRwMFIxD4sVN9mYf/AOwCCN3M=; b=FDXUirZhSYhU2KZDrZeL0/77iKoyLW2zIv6ziXbpA0MCsXrM5W/snIMnWZVnUGlQm/ dBAER31ONyABthKPx5Z7RoYiD01zUhREIp5UiFTBYU3602YUCUL63P028v5enqedUPHl 63gbuAvU+rBXBOvP8aNGsChVxbBZceBzpnhm7FpSYwAnYg42ae5T/lZDu7pi+6NuGWEx KJju+N1wBl84GZycWayAe5pOJgDADaZLQiIdbmj/HBU0dWSiB37RlkK+T/gRiDXXcX+m wGog1dKhxXz1E8L6hTeZE8R8PdOf0vkVPlsxJvdpFLjVgDuSDOceMlRfh4JakjFXD8Xi 9oTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xlY0obK+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q25si841638edr.402.2020.09.01.09.51.53; Tue, 01 Sep 2020 09:52:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xlY0obK+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732373AbgIAQtO (ORCPT + 99 others); Tue, 1 Sep 2020 12:49:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:53982 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729677AbgIAP1P (ORCPT ); Tue, 1 Sep 2020 11:27:15 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 62A4520684; Tue, 1 Sep 2020 15:27:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598974034; bh=Zr0rNtHcW9RuHn2tfuAXqac+LKY+ORnkgNnF0ZsMDDw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xlY0obK+NrKWQCSJS21DdLB2vFqiaDKmSZ6Cgl7G3P7YM/w4Wn73UvAvKxxF2OCeV EOGn9jJvRJaqbnAREZHP6586NA5xDyw8PVgTTyuE+dZo+SrdvbT0PwRZEZWRPBXZFQ JCExtKx5euLzXdshHY/gdH4Se7tMQ9k1EIuf66x0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Qiushi Wu , Jon Hunter , Mark Brown , Sasha Levin Subject: [PATCH 5.4 019/214] ASoC: tegra: Fix reference count leaks. Date: Tue, 1 Sep 2020 17:08:19 +0200 Message-Id: <20200901150953.887819585@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150952.963606936@linuxfoundation.org> References: <20200901150952.963606936@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Qiushi Wu [ Upstream commit deca195383a6085be62cb453079e03e04d618d6e ] Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count if pm_runtime_put is not called in error handling paths. Call pm_runtime_put if pm_runtime_get_sync fails. Signed-off-by: Qiushi Wu Reviewed-by: Jon Hunter Link: https://lore.kernel.org/r/20200613204422.24484-1-wu000273@umn.edu Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/tegra/tegra30_ahub.c | 4 +++- sound/soc/tegra/tegra30_i2s.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 635eacbd28d47..156e3b9d613c6 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -643,8 +643,10 @@ static int tegra30_ahub_resume(struct device *dev) int ret; ret = pm_runtime_get_sync(dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put(dev); return ret; + } ret = regcache_sync(ahub->regmap_ahub); ret |= regcache_sync(ahub->regmap_apbif); pm_runtime_put(dev); diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index e6d548fa980b6..8894b7c16a01a 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -538,8 +538,10 @@ static int tegra30_i2s_resume(struct device *dev) int ret; ret = pm_runtime_get_sync(dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put(dev); return ret; + } ret = regcache_sync(i2s->regmap); pm_runtime_put(dev); -- 2.25.1