Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9183387pxu; Mon, 28 Dec 2020 08:39:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJzrdBUulrby3X0Xzrd3DTv3JvtzEhEW6iqWCnZf7d0hUR5M+m3crsoUinceK1RZKlgCRnPJ X-Received: by 2002:a17:906:2984:: with SMTP id x4mr42565765eje.239.1609173590005; Mon, 28 Dec 2020 08:39:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173589; cv=none; d=google.com; s=arc-20160816; b=P72CIMm5rsXgd05Y6ULavkO5lnVghcNdb/HTBGY95VTT0MVMpEfJvEpheu5OnZhS3F XeWC7vYIqybyCnZaeajwEvrlXXsn0LdsLEAP/efD73jhDKdDX6+J741wiAFJRNhzyIfQ rc3m0YqcAyhib3nzJ8jVEBq/lWaEsVX+ca6A3Mj0OHBMdeArOBsodWTR6RtwiAYPWfqJ EffGZb2rFmumf7iX8xkjwNFJWQfL/U5DRD7C1D/q8txamhhMMgyVAsc1c7jBABb5uaog NDQzVAIammoIGWEJrwarg8MXuRCVuRhlrQ2nAmaOtE8SHRwa+4ucY3zm2qgcvLmYE63x xamQ== 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=vgbm5asI283dpWkkca0m8lox6WQETlxooW4CT//pW5w=; b=tk7AaNmMYhiorXxygNxY1c9/U0+yq70oZRY4MCm4ni6fMk5BbkWfpGIHA2GUL3FD0D U1DWBVChPVGDBZbl91XLIXtWzhtSkEG4niDl7DKltZtLjbZp2dOpmavzg0T6qg87ei+R TwcNJZkal5mRvJBx4w0NMGRqT+EBDx/AooB9elqsgHsLUQEOa3RWTxpZ+9gE3+fCxXuC IUY9BUIfqeJK6BlsWKJouO1xkjdZpYbHN12tFR0q4tuxlf27Jyt2V4bnWFkWYnfTmtno iloXo1DC3f5NSYcahmvthZyCQrEEiaiB+ARMgI9G+B0rm3D67C4pVlO/a/ky6Js4RMd9 +ehQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="PM/aYrUF"; 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 o22si19425157ejg.205.2020.12.28.08.39.25; Mon, 28 Dec 2020 08:39:49 -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="PM/aYrUF"; 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 S2442166AbgL1Qhg (ORCPT + 99 others); Mon, 28 Dec 2020 11:37:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:57636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729822AbgL1NBf (ORCPT ); Mon, 28 Dec 2020 08:01:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 30CC9207C9; Mon, 28 Dec 2020 13:01:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160479; bh=HJIhZb/jp000vfo5nikW6TJi20kwbfRo40g+g5sqEZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PM/aYrUFYhPGEGvQ3z4s3kBAt7rzXaSbBOD3yYMBRNbbCUHFw5g+KohL1kIyKrwkz U2yyNnY3NgE3Cb5uvvv38oHFAS1KvJHwILgrn5W3pH0UCk1jjGCATXsbf4e0F+trYL 5J1qxpN9xmvZH+B9URoF8EdD0XoY+BItGxEeFOtU= 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.9 066/175] staging: greybus: codecs: Fix reference counter leak in error handling Date: Mon, 28 Dec 2020 13:48:39 +0100 Message-Id: <20201228124856.448340696@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 8a0744b58a329..4c2d6c2d4fb41 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -491,6 +491,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; } @@ -562,6 +563,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