Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9174790pxu; Mon, 28 Dec 2020 08:26:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJxLjoEuuxDxVWzI4zE0w/BGhBMN04emDCbQKMKW4OlxqT7Mpo+2RtXzOsNwvbiUzoPYdBkz X-Received: by 2002:a17:906:3094:: with SMTP id 20mr41359815ejv.218.1609172769268; Mon, 28 Dec 2020 08:26:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172769; cv=none; d=google.com; s=arc-20160816; b=wb/FPYKsXjHLmhtpTM7strkONKyC/6B9cmH37QxeqIjdOc8iQVCUuN3nal06zM0F+H pt4l037sBbEnVd0EcdF45MMYMS/8+yYIG9V/KDm6J3cV+DBClHmGKwUmXrriCmZ/i4YS rh8aWOAOw/DHzCwnyYBrHb07tyZc79LLMBNojm8xU8o2IWHrgyVU87vWSJEo0sPHYe+t MONl+v/acjlPAMgih5gQ4nBRq3QkQirvfH1VY71m/Cn99W5xDAze6aZFqyKZ64MBpGJ1 ldSZIKm3pi/+585KKR7uATosVRx7X6c6u/Bai3e43P0ZxPKh6K1zwVEpaf1s/8GmLbkl qKfQ== 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=hBwE4taYA+28Q0j7yq9DNgRQfUQrUC6UHc9i6ykUz8E=; b=tsxsezhWxl0sxNvGJLkoNi55tudGHPb41oaEVZZ6U0RF/o4Zm1cpWL1zbKzDakAdJF OYVya/10XVf21R67kgkBAwPH9bncJml6YYlo9dWbEvOFtRlQDkASAZukcfFRCAvQiTjR Hbd+eut/20fL6jQjuA2TrwZGcM16TMlZA1oVVlwv0m3S+f2cp3DqxJuMhtglaXn6cXCQ oPm1irz0RfoID0I7gTqc1tABt/X+N3wXbadbfAPNxUV0UgUQQcXlWGSkD+TTH9xZHllT 1Samp1bY5QxrtvBBQK8LbXfhDz7ZlwupanUe+id000L1dU23TjglSoJayLey3TO2zF9F dM/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RvFCL5Zk; 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 f17si20427332edx.585.2020.12.28.08.25.46; Mon, 28 Dec 2020 08:26:09 -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=RvFCL5Zk; 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 S1732005AbgL1NMS (ORCPT + 99 others); Mon, 28 Dec 2020 08:12:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:39792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731898AbgL1NL4 (ORCPT ); Mon, 28 Dec 2020 08:11:56 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8C18720728; Mon, 28 Dec 2020 13:11:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161076; bh=LDUSEzgpQCg/tQ503EdAynkOAI60OzN7LY9fFmOsqNw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RvFCL5Zkv0wLfNVkaUdpdoGUzR5TUnBH9eZhAq/AEElvl8H8UHlTLC0uT55ajMRrz dzObOqjqv8S01SuDqK4Aah4zIdPM4mmhctCo35z7TsNPqGHBa/ZHUC7nVztEW0mnJ1 crbTIFxu3y+17H3rgtOr2ifhwmpB+EZtuzA1FXY8= 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.14 092/242] staging: greybus: codecs: Fix reference counter leak in error handling Date: Mon, 28 Dec 2020 13:48:17 +0100 Message-Id: <20201228124909.229498820@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@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 a6d01f0761f32..6ba5a34fcdf29 100644 --- a/drivers/staging/greybus/audio_codec.c +++ b/drivers/staging/greybus/audio_codec.c @@ -490,6 +490,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; } @@ -566,6 +567,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