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] [thread-next>] [day] [month] [year] [list]
Message-ID: <9c68b403-f11b-4395-a564-8172e7db5390@kernel.org>
Date: Fri, 2 Jan 2026 12:50:45 +0100
From: Krzysztof Kozlowski <krzk@...nel.org>
To: Johan Hovold <johan@...nel.org>
Cc: Srinivas Kandagatla <srini@...nel.org>, Mark Brown <broonie@...nel.org>,
 Liam Girdwood <lgirdwood@...il.com>, linux-sound@...r.kernel.org,
 linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
 stable@...r.kernel.org
Subject: Re: [PATCH 3/4] ASoC: codecs: wsa884x: fix codec initialisation

On 02/01/2026 12:43, Johan Hovold wrote:
> On Fri, Jan 02, 2026 at 12:31:21PM +0100, Krzysztof Kozlowski wrote:
>> On 02/01/2026 12:14, Johan Hovold wrote:
>>> The soundwire update_status() callback may be called multiple times with
>>> the same ATTACHED status but initialisation should only be done when
>>> transitioning from UNATTACHED to ATTACHED.
>>>
>>> Fix the inverted hw_init flag which was set to false instead of true
>>> after initialisation which defeats its purpose and may result in
>>> repeated unnecessary initialisation.
>>
>> Either it results or it does not, not "may". 
> 
> No, it depends on whether update_status() is called with the same status
> more than once. So "may" is correct here.
> 
>> If the device moves to
>> UNATTACHED state flag should be probably set to "true". This is the bug.
> 
> No, update_status() has:
> 
> 	if (wsa884x->hw_init || status != SDW_SLAVE_ATTACHED)
> 		return 0;
> 
> 	...
> 
> 	wsa884x_init(wsa884x);
> 
> so if you set hw_init to true then init is never called when status is
> changed to ATTACHED.

Uh, indeed, so this was supposed to be !wsa884x->hw_init... or indeed
your meaning. This also means that this was never passing above if() and
the init() was never called.

regcache was probably synced via runtime PM, so at least that part worked.

Did you test this driver on actual device how it affects the behavior?

> 
>>>
>>> Similarly, the initial state of the flag was also inverted so that the
>>> codec would only be initialised and brought out of regmap cache only
>>> mode if its status first transitions to UNATTACHED.
>>
>> Maybe that's confusing wording but existing code was intentional and IMO
>> almost correct. The flag is saying - we need hw init - that's why it is
>> set to true in the probe and to false AFTER the proper hw initialization
>> which is done after ATTACHED state.
> 
> All other codec drivers have hw_init mean that init has been done and
> the check in update_status() reflects that too so this driver is still
> broken.

ok


Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ