Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9127732pxu; Mon, 28 Dec 2020 07:17:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJwoD/kliupWrSP3G6V2ow5jNg2hH2ZIFipEgaVoDdzVqMAdKvX5r/IZhVUbvkBe7EUbwEIR X-Received: by 2002:a50:8744:: with SMTP id 4mr38750435edv.362.1609168670233; Mon, 28 Dec 2020 07:17:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609168670; cv=none; d=google.com; s=arc-20160816; b=Wb4JRtNMnDdKM79YbCMTRRCf39qgTu2xR97TJjqHpanMTBFdnUOPubJ7IHz6ZO9gUP aRVhh+3SsQtDd+q2+Egk4JWMWvEz8ulqp6Z6UUcWIBoQFOHORxrrHMmGZP8WziIfO6CX slsvxzhkKLGuit6MbT4x2UJwmIZeshoN5bi3sGvaftyMvMkl05mVLbfCgaaJjTwif4CH Ez7iagvphAKPtTCf2qtOoQddRj1vD8U7fHiZv6Tk6lY+tKZ50sm1qy+pfn7q3AI1/u3F TFc4MA6N7+lmfz5GA330YFNEYaOf0Sma9a2jLy8w3fCoUeiAJ3ZQrK337IDOXvzV8N9k pWkA== 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=1ahIEhjrdDVzgwqiCqeUCoUxQdpgXZ5BgOu5Kavuvxc=; b=hKhUR+Uv0O3OfFgZS6RE0ATxd6dErg9nDCNpTBGguYf6JcoB1OWVEqQOCI1E7/B+k+ MNfvkLJHGzqbTOrUutDwDxbeT8c9qyjJQoEWw91PlmIUeFf4Ye81v9WGb3EU/8FHR5eW mCEOeGZKwIW2elWVrJRCZ12/rRkE24194fbrTuXOo1m0GhFpitTzN96yCVzEejg2klD2 kjsBagqwdUrMO17Ko5GAxmiwDnAWzx5/DaJ3n2C5amvASQ/GTs5KkoSNoCzJIJvzEOS7 RPXf9oYT5Q6JvyYXksh8OCz81ch6SQPPNFHa9nnovv1ieHbAi7bjez2xFeE1j5AwVFFN /itg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Y6kH6pMq; 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 t10si20374547edq.447.2020.12.28.07.17.27; Mon, 28 Dec 2020 07:17:50 -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=Y6kH6pMq; 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 S2438182AbgL1OGo (ORCPT + 99 others); Mon, 28 Dec 2020 09:06:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:40570 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437717AbgL1OF7 (ORCPT ); Mon, 28 Dec 2020 09:05:59 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6CFEA20731; Mon, 28 Dec 2020 14:05:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164319; bh=SphIqvcA8vL/GUhRmsg360xJp3qg5hhIj+MOA7yMioE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Y6kH6pMqzupmIkvcMX7vvlc9DX+A7yFVhXIk5CegpAF5MZOQIG3K/83VURghQRJ2H THAI9U+Ni9kwEFpl83iV8FjXZWamvYppf6vV5r9855X4ks40R0Q8SuBc1L2i3JGwuB 58+IuBmccfHvFS8UKcfl0ErlTl3zVV2ZRFYjD6v4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Sasha Levin Subject: [PATCH 5.10 111/717] staging: greybus: codecs: Fix reference counter leak in error handling Date: Mon, 28 Dec 2020 13:41:49 +0100 Message-Id: <20201228125026.275928708@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 494aa823e9984..42ce6c88ea753 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