06 Oct, 2020

1 commit


17 Sep, 2020

2 commits

  • Mark Brown
     
  • When CONFIG_SND_CTL_VALIDATION is set, accesses to extended bytes
    control generate spurious error messages when the size exceeds 512
    bytes, such as

    [ 11.224223] sof_sdw sof_sdw: control 2:0:0:EQIIR5.0 eqiir_coef_5:0:
    invalid count 1024

    In addition the error check returns -EINVAL which has the nasty side
    effect of preventing applications accessing controls from working,
    e.g.

    root@plb:~# alsamixer
    cannot load mixer controls: Invalid argument

    It's agreed that the control interface has been abused since 2014, but
    forcing a check should not prevent existing solutions from working.

    This patch skips the checks conditionally if CONFIG_SND_CTL_VALIDATION
    is set and the byte array provided by topology is > 512. This
    preserves the checks for all other cases.

    Fixes: 1a3232d2f61d2 ('ASoC: topology: Add support for TLV bytes controls')
    BugLink: https://github.com/thesofproject/linux/issues/2430
    Reported-by: Takashi Iwai
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Bard Liao
    Reviewed-by: Jaska Uimonen
    Signed-off-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20200917103912.2565907-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     

08 Sep, 2020

1 commit

  • This patch adds support for write-only and read-only TLV byte kcontrols
    by checking for appropriate get/put IO handlers.

    Signed-off-by: Dharageswari R
    Reviewed-by: Guennadi Liakhovetski
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Signed-off-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20200908092825.1813847-1-kai.vehmanen@linux.intel.com
    Signed-off-by: Mark Brown

    Dharageswari R
     

24 Aug, 2020

1 commit

  • Replace the existing /* fall through */ comments and its variants with
    the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
    fall-through markings when it is the case.

    [1] https://www.kernel.org/doc/html/v5.7/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

    Signed-off-by: Gustavo A. R. Silva

    Gustavo A. R. Silva
     

08 Jul, 2020

5 commits

  • Add more dev_err() logs to help trace topology load failures, since we
    have multiple error causes (e.g. invalid header or header that could
    not be loaded).

    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Kai Vehmanen
    Reviewed-by: Rander Wang
    Link: https://lore.kernel.org/r/20200707203749.113883-6-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     
  • No need to repeat the same thing multiple times when it can be done in
    one location.

    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20200707203749.113883-5-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     
  • Since the beginning of the topology, the code continues to the next
    object even when an error is detected.

    The topology should be handled with an all-or-nothing design, loading
    a partially valid topology is a sure way to get bug reports that are
    difficult to deal with.

    Changing the behavior may break previous solutions and expose problems
    in topology files delivered in the past, so it's probably not wise to
    add this patch to stable branches without revalidation.

    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20200707203749.113883-4-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     
  • we need to free all allocated tlvs, not just the one allocated in
    the loop before releasing kcontrols - other the tlvs references will
    leak.

    Fixes: 9f90af3a995298 ('ASoC: topology: Consolidate and fix asoc_tplg_dapm_widget_*_create flow')
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20200707203749.113883-3-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     
  • When errors happens while loading graph components, the kernel oopses
    while trying to remove all topology components. This can be
    root-caused to a list pointing to memory that was already freed on
    error.

    remove_route() is already called on errors and will perform the
    required cleanups so there's no need to free the route memory in
    soc_tplg_dapm_graph_elems_load() if the route was added to the
    list. We do however want to free the routes allocated but not added to
    the list.

    Fixes: 7df04ea7a31ea ('ASoC: topology: modify dapm route loading routine and add dapm route unloading')
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Kai Vehmanen
    Link: https://lore.kernel.org/r/20200707203749.113883-2-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     

15 Jun, 2020

1 commit

  • Use devm_ to avoid use-after-free KASAN reports and simplify error
    handling.

    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Bard Liao
    Reviewed-by: Kai Vehmanen
    BugLink: https://github.com/thesofproject/linux/issues/2186
    Link: https://lore.kernel.org/r/20200612205938.26415-3-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     

29 May, 2020

2 commits

  • As we have check the 'pass' in the soc_elem_pass_load(), so no need to
    check it again in each specific elem_load function, at the same time,
    the tplg->pos will be reset to the next header base when the pass is
    mismatched, so the increasing of the tplg->pos in these cases made no
    sense. Here remove all of them.

    Signed-off-by: Keyon Jie
    Tested-by: Vamshi Kerishna Gopal
    Tested-by: Cezary Rojewski
    Reviewed-by: Cezary Rojewski
    Reviewed-by: Ranjani Sridharan
    Link: https://lore.kernel.org/r/20200527022801.336264-3-yang.jie@linux.intel.com
    Signed-off-by: Mark Brown

    Keyon Jie
     
  • The check (tplg->pass == le32_to_cpu(hdr->type)) makes no sense as it is
    comparing two different enums, refine the element loading functions, and
    log the information when the header is being parsed in the corresponding
    parsing pass.

    Signed-off-by: Keyon Jie
    Tested-by: Vamshi Kerishna Gopal
    Tested-by: Cezary Rojewski
    Reviewed-by: Cezary Rojewski
    Reviewed-by: Ranjani Sridharan
    Link: https://lore.kernel.org/r/20200527022801.336264-2-yang.jie@linux.intel.com
    Signed-off-by: Mark Brown

    Keyon Jie
     

16 Apr, 2020

3 commits

  • Daniel Baluta :

    From: Daniel Baluta

    This patch series adds support for SOF on i.MX8M family. First board
    from this family that has a DSP is i.MX8MP.

    First 2 patches are trying to fix some compilation issues, the next two
    are adding the imx8m support and the last one adds the devicetree
    binding.

    Changes since v2:
    - add reviewed by from Rob to DT patch
    - fix ownership for patch 2

    Daniel Baluta (3):
    ASoC: SOF: imx: Add i.MX8M HW support
    ASoC: SOF: Add i.MX8MP device descriptor
    dt-bindings: dsp: fsl: Add fsl,imx8mp-dsp entry

    Pierre-Louis Bossart (1):
    ASoC: SOF: imx: fix undefined reference issue

    YueHaibing (1):
    ASoC: SOF: imx8: Fix randbuild error

    .../devicetree/bindings/dsp/fsl,dsp.yaml | 2 +
    sound/soc/sof/imx/Kconfig | 32 +-
    sound/soc/sof/imx/Makefile | 2 +
    sound/soc/sof/imx/imx8m.c | 279 ++++++++++++++++++
    sound/soc/sof/sof-of-dev.c | 14 +
    5 files changed, 325 insertions(+), 4 deletions(-)
    create mode 100644 sound/soc/sof/imx/imx8m.c

    --
    2.17.1

    Mark Brown
     
  • There is unnecessary semicolon after last bracket of if statement,
    remove it.

    Signed-off-by: Amadeusz Sławiński
    Link: https://lore.kernel.org/r/20200415162435.31859-1-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown

    Amadeusz Sławiński
     
  • As done in already existing cases, we should use le32_to_cpu macro while
    accessing hdr->magic. Found with sparse.

    Signed-off-by: Amadeusz Sławiński
    Link: https://lore.kernel.org/r/20200415162435.31859-2-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown

    Amadeusz Sławiński
     

09 Apr, 2020

6 commits

  • Function soc_tplg_dai_config can fail, check for and handle possible
    failure.

    Signed-off-by: Amadeusz Sławiński
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200327204729.397-7-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown

    Amadeusz Sławiński
     
  • Function pcm_new_ver can fail, so we should check it's return value and
    handle possible error.

    Signed-off-by: Amadeusz Sławiński
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200327204729.397-6-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown

    Amadeusz Sławiński
     
  • Function soc_tplg_add_route can propagate error code from callback, we
    should check its return value and handle fail in correct way.

    Signed-off-by: Amadeusz Sławiński
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200327204729.397-5-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown

    Amadeusz Sławiński
     
  • Functions soc_tplg_denum_create, soc_tplg_dmixer_create,
    soc_tplg_dbytes_create can fail, so their return values should be
    checked and error should be propagated.

    Signed-off-by: Amadeusz Sławiński
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200327204729.397-4-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown

    Amadeusz Sławiński
     
  • Function soc_tplg_create_tlv can fail, so we should check if it succeded
    or not and proceed appropriately.

    Signed-off-by: Amadeusz Sławiński
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200327204729.397-3-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown

    Amadeusz Sławiński
     
  • kstrdup is an allocation function and it can fail, so its return value
    should be checked and handled appropriately.

    In order to check all cases, we need to modify set_stream_info to return
    a value, so check that everything went correctly when doing kstrdup().
    Later add proper checks and error handlers.

    Signed-off-by: Amadeusz Sławiński
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/20200327204729.397-2-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown

    Amadeusz Sławiński
     

01 Apr, 2020

1 commit


14 Mar, 2020

1 commit


13 Mar, 2020

1 commit

  • Function soc_tplg_dbytes_create(), calls soc_tplg_init_kcontrol() to
    perform additional driver specific initialization. While
    soc_tplg_init_kcontrol() ensures that component is valid before invoking
    ops->control_load, there is no such check at the end of
    soc_tplg_dbytes_create() where list_add() is used.

    Also in quite a few places, there is reference of tplg->comp->dapm or
    tplg->comp->card, without any checks for tplg->comp.

    In consequence of the above this may lead to referencing NULL pointer.

    This allows for removal of now unnecessary checks.

    Signed-off-by: Amadeusz Sławiński
    Reviewed-by: Ranjani Sridharan
    Link: https://lore.kernel.org/r/20200312122239.14489-1-amadeuszx.slawinski@linux.intel.com
    Signed-off-by: Mark Brown

    Amadeusz Sławiński
     

10 Mar, 2020

1 commit

  • To be more readable code, this patch adds
    new for_each_card_widgets() macro, and replace existing code to it.

    Signed-off-by: Kuninori Morimoto
    Reviewed-by: Ranjani Sridharan
    Reviewed-by: Pierre-Louis Bossart
    Link: https://lore.kernel.org/r/87r1y2goga.wl-kuninori.morimoto.gx@renesas.com
    Signed-off-by: Mark Brown

    Kuninori Morimoto
     

25 Feb, 2020

1 commit


20 Feb, 2020

2 commits

  • In case of ABI version mismatch, _manifest needs to be freed as
    it is just a copy of the original topology manifest. However, if
    a driver manifest handler is defined, that would get executed and
    the cleanup is never reached. Fix that by getting the return status
    of manifest() instead of returning directly.

    Fixes: 583958fa2e52 ("ASoC: topology: Make manifest backward compatible from ABI v4")
    Signed-off-by: Dragos Tarcatu
    Link: https://lore.kernel.org/r/20200207185325.22320-3-dragos_tarcatu@mentor.com
    Signed-off-by: Mark Brown

    Dragos Tarcatu
     
  • If soc_tplg_link_config() fails, _link needs to be freed in case of
    topology ABI version mismatch. However the current code is returning
    directly and ends up leaking memory in this case.
    This patch fixes that.

    Fixes: 593d9e52f9bb ("ASoC: topology: Add support to configure existing physical DAI links")
    Signed-off-by: Dragos Tarcatu
    Link: https://lore.kernel.org/r/20200207185325.22320-2-dragos_tarcatu@mentor.com
    Signed-off-by: Mark Brown

    Dragos Tarcatu
     

23 Jan, 2020

2 commits

  • Mark Brown
     
  • The code which checks the return value for snd_soc_add_dai_link() call
    in soc_tplg_fe_link_create() moved the snd_soc_add_dai_link() call before
    link->dobj members initialization.

    While it does not affect the latest kernels, the old soc-core.c code
    in the stable kernels is affected. The snd_soc_add_dai_link() function uses
    the link->dobj.type member to check, if the link structure is valid.

    Reorder the link->dobj initialization to make things work again.
    It's harmless for the recent code (and the structure should be properly
    initialized before other calls anyway).

    The problem is in stable linux-5.4.y since version 5.4.11 when the
    upstream commit 76d270364932 was applied.

    Fixes: 76d270364932 ("ASoC: topology: Check return value for snd_soc_add_dai_link()")
    Cc: Dragos Tarcatu
    Cc: Pierre-Louis Bossart
    Cc: Ranjani Sridharan
    Cc: Mark Brown
    Cc:
    Signed-off-by: Jaroslav Kysela
    Link: https://lore.kernel.org/r/20200122190752.3081016-1-perex@perex.cz
    Signed-off-by: Mark Brown

    Jaroslav Kysela
     

03 Jan, 2020

1 commit


26 Dec, 2019

1 commit


25 Dec, 2019

1 commit

  • remove_link() is currently calling snd_soc_remove_dai_link() after
    it has already freed the memory for the link name. But this is later
    read from snd_soc_get_pcm_runtime() causing a KASAN use-after-free
    warning. Reorder the cleanups to fix this issue.

    Reviewed-by: Ranjani Sridharan
    Signed-off-by: Dragos Tarcatu
    Signed-off-by: Pierre-Louis Bossart
    Reviewed-by: Kuninori Morimoto
    Link: https://lore.kernel.org/r/20191204210447.11701-4-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Dragos Tarcatu
     

19 Dec, 2019

1 commit

  • remove_link() is currently calling snd_soc_remove_pcm_runtime() after
    it has already freed the memory for the link name. But this is later
    read from snd_soc_get_pcm_runtime() causing a KASAN use-after-free
    warning. Reorder the cleanups to fix this issue.

    Reviewed-by: Ranjani Sridharan
    Signed-off-by: Dragos Tarcatu
    Signed-off-by: Pierre-Louis Bossart
    Acked-by: Kuninori Morimoto
    Link: https://lore.kernel.org/r/20191218000518.5830-4-pierre-louis.bossart@linux.intel.com
    Signed-off-by: Mark Brown

    Dragos Tarcatu
     

10 Dec, 2019

5 commits