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: <CAKXuJqjyjbRi2H=A_d=RgMOKSy=ZRqr0YVqsFObMYKtp66RyHA@mail.gmail.com>
Date:   Sun, 2 Jul 2023 10:35:23 -0500
From:   Steev Klimaszewski <steev@...i.org>
To:     Johan Hovold <johan+linaro@...nel.org>
Cc:     Mark Brown <broonie@...nel.org>,
        Liam Girdwood <lgirdwood@...il.com>,
        Jaroslav Kysela <perex@...ex.cz>,
        Takashi Iwai <tiwai@...e.com>, alsa-devel@...a-project.org,
        linux-kernel@...r.kernel.org, stable@...r.kernel.org,
        Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
Subject: Re: [PATCH] ASoC: codecs: wcd938x: fix soundwire initialisation race

On Sat, Jul 1, 2023 at 4:48 AM Johan Hovold <johan+linaro@...nel.org> wrote:
>
> Make sure that the soundwire device used for register accesses has been
> enumerated and initialised before trying to read the codec variant
> during component probe.
>
> This specifically avoids interpreting (a masked and shifted) -EBUSY
> errno as the variant:
>
>         wcd938x_codec audio-codec: ASoC: error at soc_component_read_no_lock on audio-codec for register: [0x000034b0] -16
>
> in case the soundwire device has not yet been initialised, which in turn
> prevents some headphone controls from being registered.
>
> Fixes: 8d78602aa87a ("ASoC: codecs: wcd938x: add basic driver")
> Cc: stable@...r.kernel.org      # 5.14
> Cc: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
> Reported-by: Steev Klimaszewski <steev@...i.org>
> Signed-off-by: Johan Hovold <johan+linaro@...nel.org>
> ---
>  sound/soc/codecs/wcd938x.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/sound/soc/codecs/wcd938x.c b/sound/soc/codecs/wcd938x.c
> index e3ae4fb2c4db..4571588fad62 100644
> --- a/sound/soc/codecs/wcd938x.c
> +++ b/sound/soc/codecs/wcd938x.c
> @@ -3080,9 +3080,18 @@ static int wcd938x_irq_init(struct wcd938x_priv *wcd, struct device *dev)
>  static int wcd938x_soc_codec_probe(struct snd_soc_component *component)
>  {
>         struct wcd938x_priv *wcd938x = snd_soc_component_get_drvdata(component);
> +       struct sdw_slave *tx_sdw_dev = wcd938x->tx_sdw_dev;
>         struct device *dev = component->dev;
> +       unsigned long time_left;
>         int ret, i;
>
> +       time_left = wait_for_completion_timeout(&tx_sdw_dev->initialization_complete,
> +                                               msecs_to_jiffies(2000));
> +       if (!time_left) {
> +               dev_err(dev, "soundwire device init timeout\n");
> +               return -ETIMEDOUT;
> +       }
> +
>         snd_soc_component_init_regmap(component, wcd938x->regmap);
>
>         ret = pm_runtime_resume_and_get(dev);
> --
> 2.39.3
>

Thank you!  Tested with this and the other patch applied on my X13s
with a pair of Apple EarPods with 3.5mm Headphone Plug, audio is quite
nice through them.

Tested-by: Steev Klimaszewski <steev@...i.org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ