Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3519455pxu; Mon, 30 Nov 2020 05:06:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJxydXFMHvXAaz+KSTrFxpEqeuaVSCgf6P/5u/h9b8N6eAeXJbRhTaaXiThGvf/2GC12FfoK X-Received: by 2002:aa7:d545:: with SMTP id u5mr21281869edr.113.1606741576800; Mon, 30 Nov 2020 05:06:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606741576; cv=none; d=google.com; s=arc-20160816; b=tM6JCQmh5RqDv4fx0pbvtwCD0gl2/g1umSrxAIsbS2vVC3yYojIaLK0Zuxur+wr+18 k8Dub6XF1addQ3aGReq9FQlwATWAmsD4M49GHVN28nfUogUf3dVw5ISgQ9OCFOEYfZzQ IBdmCWnXEDB+EI36+kffIKLLubrcoy1TsSR0CEZwkdSkzX+sRKHGQljNW52eUzRFkZy3 bKIfRu9MF5B7NI/8PSBrEXwM9OKDa0HYTjNqBsKeH4id3wZ2qSiQuyeLlbtloZjlh7pc uwxrW5K/nmXrxjqNOss0C6dqLgMVurwvp4Wx1rWmE8z1EMLm5yZY7CNlX9HRGh6DyYbj z+PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject; bh=hsTOaj/DiHy+ZGhoLeeyx+qlX5VSQkm2utLs0CU5oco=; b=NObfbFMLw2Im/CS8R5IYms8iLavJk05HTLxyQetIqLfUrI4rdm/zgUWiJVmOh6jVv3 iRTkY9bt8dO85eTz2WZiuQSvMCcDQ2hWgd73xzGUPO14TNsspLQ6VIKWN7MGFSw6XNka Jo96V8fYsvs4fkWJoeu4vyWPanFt/YVHetX5kDPlZfk9T/nkC4Zk9GVMfF2ZDWKuc1Fe yRA/rzKIFF5JnhZ1IK3g2xx26CXVPFkmyzjReP1uCj0u1Vlld43dqZlG+8fhmgTZO7fo hqp7sTZe2nTQX7ewNnKFWZGjwo210LqXLZkrqm9GJKDG2M5O4IEUY8aYj5jpJ5KZZod0 phyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si11145229edm.321.2020.11.30.05.05.28; Mon, 30 Nov 2020 05:06:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726067AbgK3NEd (ORCPT + 99 others); Mon, 30 Nov 2020 08:04:33 -0500 Received: from szxga04-in.huawei.com ([45.249.212.190]:8166 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbgK3NEd (ORCPT ); Mon, 30 Nov 2020 08:04:33 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Cl55608CWz15VmF; Mon, 30 Nov 2020 21:03:22 +0800 (CST) Received: from [10.174.177.149] (10.174.177.149) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.487.0; Mon, 30 Nov 2020 21:03:42 +0800 Subject: Re: [PATCH] hwrng: exynos - fix reference leak in exynos_trng_probe To: Krzysztof Kozlowski CC: =?UTF-8?Q?=c5=81ukasz_Stelmach?= , , , , References: <20201127094446.121277-1-miaoqinglang@huawei.com> <20201127094414.GA10679@kozik-lap> From: Qinglang Miao Message-ID: <14ffbcad-9674-443c-dc5f-cf804a686720@huawei.com> Date: Mon, 30 Nov 2020 21:03:41 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20201127094414.GA10679@kozik-lap> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.149] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org 在 2020/11/27 17:44, Krzysztof Kozlowski 写道: > On Fri, Nov 27, 2020 at 05:44:46PM +0800, Qinglang Miao wrote: >> pm_runtime_get_sync will increment pm usage counter even it >> failed. Forgetting to putting operation will result in a >> reference leak here. >> >> A new function pm_runtime_resume_and_get is introduced in >> [0] to keep usage counter balanced. So We fix the reference >> leak by replacing it with new funtion. >> >> [0] dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") > > Do not put such dependencies into the commit message - it does not bring > useful information to the history. Store it under '---' separator. > >> >> Fixes: 6cd225cc5d8a ("hwrng: exynos - add Samsung Exynos True RNG driver") >> Reported-by: Hulk Robot >> Signed-off-by: Qinglang Miao >> --- >> drivers/char/hw_random/exynos-trng.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/char/hw_random/exynos-trng.c b/drivers/char/hw_random/exynos-trng.c >> index 8e1fe3f8d..666246bc8 100644 >> --- a/drivers/char/hw_random/exynos-trng.c >> +++ b/drivers/char/hw_random/exynos-trng.c >> @@ -132,7 +132,7 @@ static int exynos_trng_probe(struct platform_device *pdev) >> return PTR_ERR(trng->mem); >> >> pm_runtime_enable(&pdev->dev); >> - ret = pm_runtime_get_sync(&pdev->dev); >> + ret = pm_runtime_resume_and_get(&pdev->dev); > > This cannot be applied. Fix it by replacing err_clock label with this > one. > > Best regards, > Krzysztof > > . Hi Krzysztof, I realize that there's a mistake in this patch through your reply. There's two way to fix this one: 1) replace err_pm_get with err_clock label when pm_runtime_get_sync fails. 2) replace pm_runtime_get_sync with pm_runtime_resume_and_get and remove redundant label(err_clock). I take 2) on v2 for it makes codes more clearer in a way. Thanks. >