Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9243197pxu; Mon, 28 Dec 2020 10:14:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwkCA8uDxR3wpLC1KKILmrVj7/YK+Xnws65rL51Kh3AMpGPM0hFSp9u/7oY6vwZd74v5E3m X-Received: by 2002:a17:906:ae55:: with SMTP id lf21mr42706157ejb.101.1609179285514; Mon, 28 Dec 2020 10:14:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609179285; cv=none; d=google.com; s=arc-20160816; b=FDFrqpIL2hmlERy9ykVf6qH98vj3OHaohxqjaRiqwXO68C7XBL575UAU/sS1cRzi0v Iir4L3K6OB2wVSCy1noo4vWyDm/2rE8alfQhZw8cQM2h7RperO97Vq9/1fTt9GdIyPgu 3mCf6fBvNtBvHT2aKrExcAqsb5ED+s5ikHL8GCgZF+kPRaOOLHjU4e1lVsLysLWZ8P6X 9awP6Nqfif08Q7AAfV+DrGET450aSr7wAAsqJlU8+N15Nogg9M+k63/hVcyql1uTdJUS ChQ5Ka+vzFNWzE/QGK23Rps4QUGva8sjV+sHUjoyLqPTFydgFhN79J10LWUDGiclmOlK vdMQ== 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=ZU1nbPpYwyRFCUssXbKlEork6ujXCM/a4YjmDjsZoeQ=; b=TlnN9oGeDNMoB/OIjcVFml6CpqxX02M/FLj3JRppFnUQtkrFTsLnNUa0sbAeSjMgEl EOU5apnbMiXuDVMKOmuyCMhOf+ZfqGfdqFpNUtmsLsEuMcZpTX2qtp+0IjEU8ekmn7lM OCw9kF8nQPqZXHcqving9zLWdsYmviHDzLFOYRrmUGo+S2JpmvTB1oFK2Q6O90G+k1lu WTbPSb4v3gFegKJHcp3ZJxXfGbVMILB7B5nNNunelXVk9ESCMWEDD1TRAlwELITKSY2F fmkV3ROLNWIx1D14seYdLbp7vvJuJVzasl68IGgICDJRbj55yMef6wNHXGZxc452D7Ag Oycw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WKxkwSTu; 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=pass (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 f8si18898704ejc.50.2020.12.28.10.14.22; Mon, 28 Dec 2020 10:14:45 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=WKxkwSTu; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389624AbgL1N10 (ORCPT + 99 others); Mon, 28 Dec 2020 08:27:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:54636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389200AbgL1N0I (ORCPT ); Mon, 28 Dec 2020 08:26:08 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B5ABC22472; Mon, 28 Dec 2020 13:25:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161953; bh=NyJxix9UlwTf3UE+Z333I0rQe4WgJburj1ZJcyQebMY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WKxkwSTuMpWb9O17cEHJ+MGDnz/uFJcTZ61CmZtXtL+RmetF17sUhkHi0jnRYoqXW 45C+nf9EHt6WZpCEGJCzdzMY4GLdDgIYepfgM+bjdHmEWoxCIYiJ2h8EYyx/wMTN6W 4hrGe3GaykFs71/yLidBJim+5xAA9p7Aj4BaKGF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Sasha Levin Subject: [PATCH 4.19 138/346] staging: greybus: codecs: Fix reference counter leak in error handling Date: Mon, 28 Dec 2020 13:47:37 +0100 Message-Id: <20201228124926.462859447@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124919.745526410@linuxfoundation.org> References: <20201228124919.745526410@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Qilong [ Upstream commit 3952659a6108f77a0d062d8e8487bdbdaf52a66c ] gb_pm_runtime_get_sync has increased the usage counter of the device here. Forgetting to call gb_pm_runtime_put_noidle will result in usage counter leak in the error branch of (gbcodec_hw_params and gbcodec_prepare). We fixed it by adding it. Fixes: c388ae7696992 ("greybus: audio: Update pm runtime support in dai_ops callback") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201109131347.1725288-2-zhangqilong3@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/greybus/audio_codec.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/greybus/audio_codec.c b/drivers/staging/greybus/audio_codec.c index 35acd55ca5ab7..6cbf69a57dfd9 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -489,6 +489,7 @@ static int gbcodec_hw_params(struct snd_pcm_substream *substream, if (ret) { dev_err_ratelimited(dai->dev, "%d: Error during set_config\n", ret); + gb_pm_runtime_put_noidle(bundle); mutex_unlock(&codec->lock); return ret; } @@ -565,6 +566,7 @@ static int gbcodec_prepare(struct snd_pcm_substream *substream, break; } if (ret) { + gb_pm_runtime_put_noidle(bundle); mutex_unlock(&codec->lock); dev_err_ratelimited(dai->dev, "set_data_size failed:%d\n", ret); -- 2.27.0