Skip to content
Snippets Groups Projects
  1. Apr 02, 2019
  2. Apr 01, 2019
  3. Mar 26, 2019
  4. Mar 25, 2019
    • Pankaj Bharadiya's avatar
      ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_free_kcontrol · cacea3a9
      Pankaj Bharadiya authored
      
      w_text_param can be NULL and it is being dereferenced without checking.
      Add the missing sanity check to prevent  NULL pointer dereference.
      
      Signed-off-by: default avatarPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      cacea3a9
    • Guenter Roeck's avatar
      ASoC: intel: Fix crash at suspend/resume after failed codec registration · 8f71370f
      Guenter Roeck authored
      
      If codec registration fails after the ASoC Intel SST driver has been probed,
      the kernel will Oops and crash at suspend/resume.
      
      general protection fault: 0000 [#1] PREEMPT SMP KASAN PTI
      CPU: 1 PID: 2811 Comm: cat Tainted: G        W         4.19.30 #15
      Hardware name: GOOGLE Clapper, BIOS Google_Clapper.5216.199.7 08/22/2014
      RIP: 0010:snd_soc_suspend+0x5a/0xd21
      Code: 03 80 3c 10 00 49 89 d7 74 0b 48 89 df e8 71 72 c4 fe 4c 89
      fa 48 8b 03 48 89 45 d0 48 8d 98 a0 01 00 00 48 89 d8 48 c1 e8 03
      <8a> 04 10 84 c0 0f 85 85 0c 00 00 80 3b 00 0f 84 6b 0c 00 00 48 8b
      RSP: 0018:ffff888035407750 EFLAGS: 00010202
      RAX: 0000000000000034 RBX: 00000000000001a0 RCX: 0000000000000000
      RDX: dffffc0000000000 RSI: 0000000000000008 RDI: ffff88805c417098
      RBP: ffff8880354077b0 R08: dffffc0000000000 R09: ffffed100b975718
      R10: 0000000000000001 R11: ffffffff949ea4a3 R12: 1ffff1100b975746
      R13: dffffc0000000000 R14: ffff88805cba4588 R15: dffffc0000000000
      FS:  0000794a78e91b80(0000) GS:ffff888068d00000(0000) knlGS:0000000000000000
      CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      CR2: 00007bd5283ccf58 CR3: 000000004b7aa000 CR4: 00000000001006e0
      Call Trace:
      ? dpm_complete+0x67b/0x67b
      ? i915_gem_suspend+0x14d/0x1ad
      sst_soc_prepare+0x91/0x1dd
      ? sst_be_hw_params+0x7e/0x7e
      dpm_prepare+0x39a/0x88b
      dpm_suspend_start+0x13/0x9d
      suspend_devices_and_enter+0x18f/0xbd7
      ? arch_suspend_enable_irqs+0x11/0x11
      ? printk+0xd9/0x12d
      ? lock_release+0x95f/0x95f
      ? log_buf_vmcoreinfo_setup+0x131/0x131
      ? rcu_read_lock_sched_held+0x140/0x22a
      ? __bpf_trace_rcu_utilization+0xa/0xa
      ? __pm_pr_dbg+0x186/0x190
      ? pm_notifier_call_chain+0x39/0x39
      ? suspend_test+0x9d/0x9d
      pm_suspend+0x2f4/0x728
      ? trace_suspend_resume+0x3da/0x3da
      ? lock_release+0x95f/0x95f
      ? kernfs_fop_write+0x19f/0x32d
      state_store+0xd8/0x147
      ? sysfs_kf_read+0x155/0x155
      kernfs_fop_write+0x23e/0x32d
      __vfs_write+0x108/0x608
      ? vfs_read+0x2e9/0x2e9
      ? rcu_read_lock_sched_held+0x140/0x22a
      ? __bpf_trace_rcu_utilization+0xa/0xa
      ? debug_smp_processor_id+0x10/0x10
      ? selinux_file_permission+0x1c5/0x3c8
      ? rcu_sync_lockdep_assert+0x6a/0xad
      ? __sb_start_write+0x129/0x2ac
      vfs_write+0x1aa/0x434
      ksys_write+0xfe/0x1be
      ? __ia32_sys_read+0x82/0x82
      do_syscall_64+0xcd/0x120
      entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
      In the observed situation, the problem is seen because the codec driver
      failed to probe due to a hardware problem.
      
      max98090 i2c-193C9890:00: Failed to read device revision: -1
      max98090 i2c-193C9890:00: ASoC: failed to probe component -1
      cht-bsw-max98090 cht-bsw-max98090: ASoC: failed to instantiate card -1
      cht-bsw-max98090 cht-bsw-max98090: snd_soc_register_card failed -1
      cht-bsw-max98090: probe of cht-bsw-max98090 failed with error -1
      
      The problem is similar to the problem solved with commit 2fc995a8
      ("ASoC: intel: Fix crash at suspend/resume without card registration"),
      but codec registration fails at a later point. At that time, the pointer
      checked with the above mentioned commit is already set, but it is not
      cleared if the device is subsequently removed. Adding a remove function
      to clear the pointer fixes the problem.
      
      Cc: stable@vger.kernel.org
      Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
      Cc: Curtis Malainey <cujomalainey@chromium.org>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      8f71370f
  5. Mar 21, 2019
  6. Mar 20, 2019
  7. Mar 19, 2019
  8. Mar 18, 2019
  9. Mar 14, 2019
  10. Mar 13, 2019
  11. Mar 11, 2019
    • Jiada Wang's avatar
      ASoC: rsnd: src: fix compiler warnings · 399706df
      Jiada Wang authored
      
      compiler complains about following declarations
      
      sound/soc/sh/rcar/src.c:174:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
       const static u32 bsdsr_table_pattern1[] = {
       ^~~~~
      sound/soc/sh/rcar/src.c:183:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
       const static u32 bsdsr_table_pattern2[] = {
       ^~~~~
      sound/soc/sh/rcar/src.c:192:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
       const static u32 bsisr_table[] = {
       ^~~~~
      sound/soc/sh/rcar/src.c:201:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
       const static u32 chan288888[] = {
       ^~~~~
      sound/soc/sh/rcar/src.c:210:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
       const static u32 chan244888[] = {
       ^~~~~
      sound/soc/sh/rcar/src.c:219:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
       const static u32 chan222222[] = {
       ^~~~~
      
      This patch moves the 'static' keyword to the front of the
      declaration to fix the compiler warnings
      
      Fixes: linux-next commit 7674bec4 ("ASoC: rsnd: update BSDSR/BSDISR handling")
      Signed-off-by: default avatarJiada Wang <jiada_wang@mentor.com>
      Acked-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      399706df
    • Jiada Wang's avatar
      ASoC: rsnd: src: Avoid a potential deadlock · ba164a49
      Jiada Wang authored
      
      lockdep warns us that priv->lock and k->k_lock can cause a
      deadlock when after acquire of k->k_lock, process is interrupted
      by src, while in another routine of src .init, k->k_lock is
      acquired with priv->lock held.
      
      This patch avoids a potential deadlock by not calling soc_device_match()
      in SRC .init callback, instead it adds new soc fields in priv->flags to
      differentiate SoCs.
      
      Fixes: linux-next commit 7674bec4 ("ASoC: rsnd: update BSDSR/BSDISR handling")
      Signed-off-by: default avatarJiada Wang <jiada_wang@mentor.com>
      Acked-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      ba164a49
    • Olivier Moysan's avatar
      ASoC: stm32: i2s: fix registers declaration in regmap · a39fe6e2
      Olivier Moysan authored
      
      - Declare SR as volatile, as it is changed by hardware.
      - Remove TXDR from readable and volatile register list,
      as it is intended for write accesses only.
      
      Signed-off-by: default avatarOlivier Moysan <olivier.moysan@st.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      a39fe6e2
    • John Hsu's avatar
      ASoC: nau8824: fix the issue of the widget with prefix name · 844a4a36
      John Hsu authored
      
      The driver has two issues when machine add prefix name for codec.
      (1)The stream name of DAI can't find the AIF widgets.
      (2)The drivr can enable/disalbe the MICBIAS and SAR widgets.
      
      The patch will fix these issues caused by prefixed name added.
      
      Signed-off-by: default avatarJohn Hsu <KCHSU0@nuvoton.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      844a4a36
    • KaiChieh Chuang's avatar
      ASoC: dpcm: prevent snd_soc_dpcm use after free · a9764869
      KaiChieh Chuang authored
      
      The dpcm get from fe_clients/be_clients
      may be free before use
      
      Add a spin lock at snd_soc_card level,
      to protect the dpcm instance.
      The lock may be used in atomic context, so use spin lock.
      
      Use irq spin lock version,
      since the lock may be used in interrupts.
      
      possible race condition between
      void dpcm_be_disconnect(
      	...
      	list_del(&dpcm->list_be);
      	list_del(&dpcm->list_fe);
      	kfree(dpcm);
      	...
      
      and
      	for_each_dpcm_fe()
      	for_each_dpcm_be*()
      
      race condition example
      Thread 1:
          snd_soc_dapm_mixer_update_power()
              -> soc_dpcm_runtime_update()
                  -> dpcm_be_disconnect()
                      -> kfree(dpcm);
      Thread 2:
          dpcm_fe_dai_trigger()
              -> dpcm_be_dai_trigger()
                  -> snd_soc_dpcm_can_be_free_stop()
                      -> if (dpcm->fe == fe)
      
      Excpetion Scenario:
      	two FE link to same BE
      	FE1 -> BE
      	FE2 ->
      
      	Thread 1: switch of mixer between FE2 -> BE
      	Thread 2: pcm_stop FE1
      
      Exception:
      
      Unable to handle kernel paging request at virtual address dead0000000000e0
      
      pc=<> [<ffffff8960e2cd10>] dpcm_be_dai_trigger+0x29c/0x47c
      	sound/soc/soc-pcm.c:3226
      		if (dpcm->fe == fe)
      lr=<> [<ffffff8960e2f694>] dpcm_fe_dai_do_trigger+0x94/0x26c
      
      Backtrace:
      [<ffffff89602dba80>] notify_die+0x68/0xb8
      [<ffffff896028c7dc>] die+0x118/0x2a8
      [<ffffff89602a2f84>] __do_kernel_fault+0x13c/0x14c
      [<ffffff89602a27f4>] do_translation_fault+0x64/0xa0
      [<ffffff8960280cf8>] do_mem_abort+0x4c/0xd0
      [<ffffff8960282ad0>] el1_da+0x24/0x40
      [<ffffff8960e2cd10>] dpcm_be_dai_trigger+0x29c/0x47c
      [<ffffff8960e2f694>] dpcm_fe_dai_do_trigger+0x94/0x26c
      [<ffffff8960e2edec>] dpcm_fe_dai_trigger+0x3c/0x44
      [<ffffff8960de5588>] snd_pcm_do_stop+0x50/0x5c
      [<ffffff8960dded24>] snd_pcm_action+0xb4/0x13c
      [<ffffff8960ddfdb4>] snd_pcm_drop+0xa0/0x128
      [<ffffff8960de69bc>] snd_pcm_common_ioctl+0x9d8/0x30f0
      [<ffffff8960de1cac>] snd_pcm_ioctl_compat+0x29c/0x2f14
      [<ffffff89604c9d60>] compat_SyS_ioctl+0x128/0x244
      [<ffffff8960283740>] el0_svc_naked+0x34/0x38
      [<ffffffffffffffff>] 0xffffffffffffffff
      
      Signed-off-by: default avatarKaiChieh Chuang <kaichieh.chuang@mediatek.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      a9764869
    • Rander Wang's avatar
      ASoC:intel:skl:fix a simultaneous playback & capture issue on hda platform · c899df3e
      Rander Wang authored
      
      If playback and capture are enabled concurrently, when the capture stops
      the output becomes inaudile. The playback application will become stuck
      and underrun after a timeout.
      
      This is caused by mistaken use of the stream_id, which should only be
      set for playback and not for capture
      
      Tested on Apollolake and Kabylake with SST driver.
      
      Signed-off-by: default avatarRander Wang <rander.wang@linux.intel.com>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      c899df3e
    • Rander Wang's avatar
      ASoC:hdac_hda:use correct format to setup hda codec · 03d0aa4d
      Rander Wang authored
      
      The current implementation of the hdac_hda codec results in zero-valued
      samples on capture and noise with headset playback when SOF is used on
      platforms with an on-board HDaudio codec. This is root-caused to SOF
      using be_hw_params_fixup, and the prepare() call using invalid runtime
      fields to determine the format.
      
      This patch moves the format handling to the hw_params() callback, as
      done already for hdac_hdmi, to make sure the fixed-up information is
      taken into account but keeps the codec initialization in prepare() as
      the stream_tag is only available at that time. Moving everything in the
      prepare() callback is possible but the code is less elegant so this
      two-step solution was chosen.
      
      The solution was tested with the SST driver with no regressions, and all
      the issues with SOF playback and capture are solved.
      
      Signed-off-by: default avatarRander Wang <rander.wang@linux.intel.com>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      03d0aa4d
    • Rander Wang's avatar
      ASoC:soc-pcm:fix a codec fixup issue in TDM case · 570f18b6
      Rander Wang authored
      
      On HDaudio platforms, if playback is started when capture is working,
      there is no audible output.
      
      This can be root-caused to the use of the rx|tx_mask to store an HDaudio
      stream tag.
      
      If capture is stared before playback, rx_mask would be non-zero on HDaudio
      platform, then the channel number of playback, which is in the same codec
      dai with the capture, would be changed by soc_pcm_codec_params_fixup based
      on the tx_mask at first, then overwritten by this function based on rx_mask
      at last.
      
      According to the author of tx|rx_mask, tx_mask is for playback and rx_mask
      is for capture. And stream direction is checked at all other references of
      tx|rx_mask in ASoC, so here should be an error. This patch checks stream
      direction for tx|rx_mask for fixup function.
      
      This issue would affect not only HDaudio+ASoC, but also I2S codecs if the
      channel number based on rx_mask is not equal to the one for tx_mask. It could
      be rarely reproduecd because most drivers in kernel set the same channel number
      to tx|rx_mask or rx_mask is zero.
      
      Tested on all platforms using stream_tag & HDaudio and intel I2S platforms.
      
      Signed-off-by: default avatarRander Wang <rander.wang@linux.intel.com>
      Acked-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      570f18b6
    • Sylwester Nawrocki's avatar
      ASoC: samsung: i2s: Fix DAPM routes for capture stream · 42e4cedd
      Sylwester Nawrocki authored
      
      This patch sets missing stream_name of capture part of the DAI driver
      so we can define DAPM routing properly also for the capture stream.
      
      While at it "Playback" suffix is added to the playback stream names
      to clearly identify playback/capture.
      
      Together with related dts patch this fixes NULL pointer dereference
      when opening ALSA device for recording on Odroid XU3.
      
      Fixes: 64aba9bc ("ASoC: samsung: i2s: Add widgets and routes for DPCM support")
      Signed-off-by: default avatarSylwester Nawrocki <s.nawrocki@samsung.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      42e4cedd
  12. Mar 04, 2019
    • Jonathan Hunter's avatar
      ASoC: soc-core: Fix probe deferral following prelink failure · c342febc
      Jonathan Hunter authored
      
      Commit 78a24e10 ("ASoC: soc-core: clear platform pointers on error")
      re-worked the clean-up of any platform pointers that may have been
      initialised by the function snd_soc_init_platform(). This commit missed
      one error path where if any of the prelinks for a soundcard failed to
      initialise, then these platform pointers would not be cleaned-up. This
      then prevents the soundcard from being initialised following a probe
      deferral when any of the soundcard prelinks cannot be found.
      
      Fix this by ensuring that soc_cleanup_platform() is called when
      initialising the soundcard prelinks fails.
      
      Fixes: 78a24e10 ("ASoC: soc-core: clear platform pointers on error")
      
      Signed-off-by: default avatarJonathan Hunter <jonathanh@nvidia.com>
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      Unverified
      c342febc
Loading