lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Fri, 17 Jun 2022 14:47:39 -0500
From:   Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
To:     alsa-devel@...a-project.org
Cc:     Cezary Rojewski <cezary.rojewski@...el.com>,
        Kai Vehmanen <kai.vehmanen@...ux.intel.com>,
        Liam Girdwood <lgirdwood@...il.com>, tiwai@...e.de,
        open list <linux-kernel@...r.kernel.org>,
        Takashi Iwai <tiwai@...e.com>,
        Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>,
        broonie@...nel.org,
        Amadeusz Sławiński 
        <amadeuszx.slawinski@...ux.intel.com>,
        Bard Liao <yung-chuan.liao@...ux.intel.com>
Subject: Re: [PATCH 03/11] ASoC: soc-component: use
 pm_runtime_resume_and_get()



On 6/16/22 17:04, Pierre-Louis Bossart wrote:
> simplify the flow. No functionality change, except that on -EACCESS
> the reference count will be decreased.

This patch turns out to be incorrect and should not be merged.

I missed the fact that the component pm_runtime_put() will decrease the
reference count that is already decreased with
pm_runtime_resume_and_get() when pm_runtime is not enabled. This leads
to warnings:

snd-soc-dummy snd-soc-dummy: Runtime PM usage count underflow!

Unfortunately we missed those warnings during validation, that's not so
good.

pm_runtime_resume_and_get() really needs to be used ONLY when the
get/put are part of the same function and the reference count can be
checked. When the get/put are in different functions, it's asking for
trouble.

Also the check on -EACCES is problematic when the component is handled
by a framework, it's not clear if that can happen or not.

The rest of the patches follow the pattern get_sync/put and don't have a
problem.

Sorry for the noise.

> 
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
> Reviewed-by: Bard Liao <yung-chuan.liao@...ux.intel.com>
> Reviewed-by: Kai Vehmanen <kai.vehmanen@...ux.intel.com>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@...ux.intel.com>
> ---
>  sound/soc/soc-component.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
> index e12f8244242b9..cb92e002c38bc 100644
> --- a/sound/soc/soc-component.c
> +++ b/sound/soc/soc-component.c
> @@ -1213,11 +1213,11 @@ int snd_soc_pcm_component_pm_runtime_get(struct snd_soc_pcm_runtime *rtd,
>  	int i;
>  
>  	for_each_rtd_components(rtd, i, component) {
> -		int ret = pm_runtime_get_sync(component->dev);
> -		if (ret < 0 && ret != -EACCES) {
> -			pm_runtime_put_noidle(component->dev);
> +		int ret = pm_runtime_resume_and_get(component->dev);
> +
> +		if (ret < 0 && ret != -EACCES)
>  			return soc_component_ret(component, ret);
> -		}
> +
>  		/* mark stream if succeeded */
>  		soc_component_mark_push(component, stream, pm);
>  	}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ