Skip to content
  1. Aug 22, 2019
    • Takashi Iwai's avatar
      ALSA: usb-audio: Check mixer unit bitmap yet more strictly · f9f0e9ed
      Takashi Iwai authored
      The bmControls (for UAC1) or bmMixerControls (for UAC2/3) bitmap has a
      variable size depending on both input and output pins.  Its size is to
      fit with input * output bits.  The problem is that the input size
      can't be determined simply from the unit descriptor itself but it
      needs to parse the whole connected sources.  Although the
      uac_mixer_unit_get_channels() tries to check some possible overflow of
      this bitmap, it's incomplete due to the lack of the  evaluation of
      input pins.
      
      For covering possible overflows, this patch adds the bitmap overflow
      check in the loop of input pins in parse_audio_mixer_unit().
      
      Fixes: 0bfe5e43
      
       ("ALSA: usb-audio: Check mixer unit descriptors more strictly")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f9f0e9ed
    • Takashi Iwai's avatar
      ALSA: line6: Fix memory leak at line6_init_pcm() error path · 1bc8d18c
      Takashi Iwai authored
      I forgot to release the allocated object at the early error path in
      line6_init_pcm().  For addressing it, slightly shuffle the code so
      that the PCM destructor (pcm->private_free) is assigned properly
      before all error paths.
      
      Fixes: 34501219
      
       ("ALSA: line6: Fix write on zero-sized buffer")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1bc8d18c
  2. Aug 21, 2019
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate() · 6de3c9e3
      Takashi Iwai authored
      The quirk function snd_emuusb_set_samplerate() has a NULL check for
      the mixer element, but this is useless in the current code.  It used
      to be a check against mixer->id_elems[unitid] but it was changed later
      to the value after mixer_eleme_list_to_info() which is always non-NULL
      due to the container_of() usage.
      
      This patch fixes the check before the conversion.
      
      While we're at it, correct a typo in the comment in the function,
      too.
      
      Fixes: 8c558076
      
       ("ALSA: usb-audio: Clean up mixer element list traverse")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6de3c9e3
  3. Aug 20, 2019
  4. Aug 16, 2019
  5. Aug 15, 2019
    • Hui Peng's avatar
      ALSA: usb-audio: Fix an OOB bug in parse_audio_mixer_unit · daac0715
      Hui Peng authored
      
      
      The `uac_mixer_unit_descriptor` shown as below is read from the
      device side. In `parse_audio_mixer_unit`, `baSourceID` field is
      accessed from index 0 to `bNrInPins` - 1, the current implementation
      assumes that descriptor is always valid (the length  of descriptor
      is no shorter than 5 + `bNrInPins`). If a descriptor read from
      the device side is invalid, it may trigger out-of-bound memory
      access.
      
      ```
      struct uac_mixer_unit_descriptor {
      	__u8 bLength;
      	__u8 bDescriptorType;
      	__u8 bDescriptorSubtype;
      	__u8 bUnitID;
      	__u8 bNrInPins;
      	__u8 baSourceID[];
      }
      ```
      
      This patch fixes the bug by add a sanity check on the length of
      the descriptor.
      
      Reported-by: default avatarHui Peng <benquike@gmail.com>
      Reported-by: default avatarMathias Payer <mathias.payer@nebelwelt.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarHui Peng <benquike@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      daac0715
  6. Aug 14, 2019
    • Hui Wang's avatar
      ALSA: hda - Add a generic reboot_notify · 871b9066
      Hui Wang authored
      
      
      Make codec enter D3 before rebooting or poweroff can fix the noise
      issue on some laptops. And in theory it is harmless for all codecs
      to enter D3 before rebooting or poweroff, let us add a generic
      reboot_notify, then realtek and conexant drivers can call this
      function.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      871b9066
    • Hui Wang's avatar
      ALSA: hda - Let all conexant codec enter D3 when rebooting · 401714d9
      Hui Wang authored
      
      
      We have 3 new lenovo laptops which have conexant codec 0x14f11f86,
      these 3 laptops also have the noise issue when rebooting, after
      letting the codec enter D3 before rebooting or poweroff, the noise
      disappers.
      
      Instead of adding a new ID again in the reboot_notify(), let us make
      this function apply to all conexant codec. In theory make codec enter
      D3 before rebooting or poweroff is harmless, and I tested this change
      on a couple of other Lenovo laptops which have different conexant
      codecs, there is no side effect so far.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      401714d9
  7. Aug 13, 2019
  8. Aug 10, 2019
    • Wenwen Wang's avatar
      ALSA: hda - Fix a memory leak bug · cfef67f0
      Wenwen Wang authored
      In snd_hda_parse_generic_codec(), 'spec' is allocated through kzalloc().
      Then, the pin widgets in 'codec' are parsed. However, if the parsing
      process fails, 'spec' is not deallocated, leading to a memory leak.
      
      To fix the above issue, free 'spec' before returning the error.
      
      Fixes: 352f7f91
      
       ("ALSA: hda - Merge Realtek parser code to generic parser")
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      cfef67f0
  9. Aug 09, 2019
  10. Aug 08, 2019
    • Wenwen Wang's avatar
      ALSA: firewire: fix a memory leak bug · 1be3c1fa
      Wenwen Wang authored
      In iso_packets_buffer_init(), 'b->packets' is allocated through
      kmalloc_array(). Then, the aligned packet size is checked. If it is
      larger than PAGE_SIZE, -EINVAL will be returned to indicate the error.
      However, the allocated 'b->packets' is not deallocated on this path,
      leading to a memory leak.
      
      To fix the above issue, free 'b->packets' before returning the error code.
      
      Fixes: 31ef9134
      
       ("ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver")
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org> # v2.6.39+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1be3c1fa
    • Wenwen Wang's avatar
      sound: fix a memory leak bug · c7cd7c74
      Wenwen Wang authored
      
      
      In sound_insert_unit(), the controlling structure 's' is allocated through
      kmalloc(). Then it is added to the sound driver list by invoking
      __sound_insert_unit(). Later on, if __register_chrdev() fails, 's' is
      removed from the list through __sound_remove_unit(). If 'index' is not less
      than 0, -EBUSY is returned to indicate the error. However, 's' is not
      deallocated on this execution path, leading to a memory leak bug.
      
      To fix the above issue, free 's' before -EBUSY is returned.
      
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c7cd7c74
  11. Aug 07, 2019
    • Takashi Iwai's avatar
      ALSA: hda - Workaround for crackled sound on AMD controller (1022:1457) · c02f77d3
      Takashi Iwai authored
      
      
      A long-time problem on the recent AMD chip (X370, X470, B450, etc with
      PCI ID 1022:1457) with Realtek codecs is the crackled or distorted
      sound for capture streams, as well as occasional playback hiccups.
      After lengthy debugging sessions, the workarounds we've found are like
      the following:
      
      - Set up the proper driver caps for this controller, similar as the
        other AMD controller.
      
      - Correct the DMA position reporting with the fixed FIFO size, which
        is similar like as workaround used for VIA chip set.
      
      - Even after the position correction, PulseAudio still shows
        mysterious stalls of playback streams when a capture is triggered in
        timer-scheduled mode.  Since we have no clear way to eliminate the
        stall, pass the BATCH PCM flag for PA to suppress the tsched mode as
        a temporary workaround.
      
      This patch implements the workarounds.  For the driver caps, it
      defines a new preset, AXZ_DCAPS_PRESET_AMD_SB.  It enables the FIFO-
      corrected position reporting (corresponding to the new position_fix=6)
      and enforces the SNDRV_PCM_INFO_BATCH flag.
      
      Note that the current implementation is merely a workaround.
      Hopefully we'll find a better alternative in future, especially about
      removing the BATCH flag hack again.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=195303
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c02f77d3
    • Wenwen Wang's avatar
      ALSA: hiface: fix multiple memory leak bugs · 3d92aa45
      Wenwen Wang authored
      In hiface_pcm_init(), 'rt' is firstly allocated through kzalloc(). Later
      on, hiface_pcm_init_urb() is invoked to initialize 'rt->out_urbs[i]'. In
      hiface_pcm_init_urb(), 'rt->out_urbs[i].buffer' is allocated through
      kzalloc().  However, if hiface_pcm_init_urb() fails, both 'rt' and
      'rt->out_urbs[i].buffer' are not deallocated, leading to memory leak bugs.
      Also, 'rt->out_urbs[i].buffer' is not deallocated if snd_pcm_new() fails.
      
      To fix the above issues, free 'rt' and 'rt->out_urbs[i].buffer'.
      
      Fixes: a91c3fb2
      
       ("Add M2Tech hiFace USB-SPDIF driver")
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3d92aa45
  12. Aug 06, 2019
    • Takashi Iwai's avatar
      ALSA: hda - Don't override global PCM hw info flag · c1c6c877
      Takashi Iwai authored
      The commit bfcba288 ("ALSA - hda: Add support for link audio time
      reporting") introduced the conditional PCM hw info setup, but it
      overwrites the global azx_pcm_hw object.  This will cause a problem if
      any other HD-audio controller, as it'll inherit the same bit flag
      although another controller doesn't support that feature.
      
      Fix the bug by setting the PCM hw info flag locally.
      
      Fixes: bfcba288
      
       ("ALSA - hda: Add support for link audio time reporting")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      c1c6c877
    • Wenwen Wang's avatar
      ALSA: usb-audio: fix a memory leak bug · a6706020
      Wenwen Wang authored
      In snd_usb_get_audioformat_uac3(), a structure for channel maps 'chmap' is
      allocated through kzalloc() before the execution goto 'found_clock'.
      However, this structure is not deallocated if the memory allocation for
      'pd' fails, leading to a memory leak bug.
      
      To fix the above issue, free 'fp->chmap' before returning NULL.
      
      Fixes: 7edf3b5e
      
       ("ALSA: usb-audio: AudioStreaming Power Domain parsing")
      Signed-off-by: default avatarWenwen Wang <wenwen@cs.uga.edu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a6706020
    • Takashi Iwai's avatar
      Merge tag 'asoc-fix-v5.3-rc3-2' of... · d1d03306
      Takashi Iwai authored
      Merge tag 'asoc-fix-v5.3-rc3-2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: Fixes for v5.3
      
      Incremental fix removing executable bits added in a prior patch
      accidentally.
      d1d03306
    • Takashi Iwai's avatar
      Merge tag 'asoc-fix-v5.3-rc3' of... · c2913b14
      Takashi Iwai authored
      Merge tag 'asoc-fix-v5.3-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: Fixes for v5.3
      
      A relatively large batch of mostly unremarkable fixes here, a couple of
      small core fixes for fairly obscure issues, more comment/email updates
      with no code impact than usual and a bunch of small driver fixes.
      
      The support for new sample rates in the max98373 driver is a fix for the
      fact that the driver declared support for those rates but would in fact
      return an error if these rates were selected.
      c2913b14
    • Mark Brown's avatar
      ASoC: max98373: Remove executable bits · 7c076764
      Mark Brown authored
      
      
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      7c076764
  13. Aug 03, 2019
  14. Jul 31, 2019
  15. Jul 30, 2019
  16. Jul 27, 2019
    • Samuel Thibault's avatar
      ALSA: hda: Fix 1-minute detection delay when i915 module is not available · 74bf71ed
      Samuel Thibault authored
      Distribution installation images such as Debian include different sets
      of modules which can be downloaded dynamically.  Such images may notably
      include the hda sound modules but not the i915 DRM module, even if the
      latter was enabled at build time, as reported on
      https://bugs.debian.org/931507
      
      In such a case hdac_i915 would be linked in and try to load the i915
      module, fail since it is not there, but still wait for a whole minute
      before giving up binding with it.
      
      This fixes such as case by only waiting for the binding if the module
      was properly loaded (or module support is disabled, in which case i915
      is already compiled-in anyway).
      
      Fixes: f9b54e19
      
       ("ALSA: hda/i915: Allow delayed i915 audio component binding")
      Signed-off-by: default avatarSamuel Thibault <samuel.thibault@ens-lyon.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      74bf71ed
  17. Jul 26, 2019
    • Peter Ujfalusi's avatar
      ASoC: ti: davinci-mcasp: Correct slot_width posed constraint · 1e112c35
      Peter Ujfalusi authored
      
      
      The slot_width is a property for the bus while the constraint for
      SNDRV_PCM_HW_PARAM_SAMPLE_BITS is for the in memory format.
      
      Applying slot_width constraint to sample_bits works most of the time, but
      it will blacklist valid formats in some cases.
      
      With slot_width 24 we can support S24_3LE and S24_LE formats as they both
      look the same on the bus, but a a 24 constraint on sample_bits would not
      allow S24_LE as it is stored in 32bits in memory.
      
      Implement a simple hw_rule function to allow all formats which require less
      or equal number of bits on the bus as slot_width (if configured).
      
      Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
      Link: https://lore.kernel.org/r/20190726064244.3762-2-peter.ujfalusi@ti.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      1e112c35
    • Cheng-Yi Chiang's avatar
      ASoC: rockchip: Fix mono capture · 789e162a
      Cheng-Yi Chiang authored
      This reverts commit db51707b
      
      .
      Revert "ASoC: rockchip: i2s: Support mono capture"
      
      Previous discussion in
      
      https://patchwork.kernel.org/patch/10147153/
      
      explains the issue of the patch.
      While device is configured as 1-ch, hardware is still
      generating a 2-ch stream.
      When user space reads the data and assumes it is a 1-ch stream,
      the rate will be slower by 2x.
      
      Revert the change so 1-ch is not supported.
      User space can selectively take one channel data out of two channel
      if 1-ch is preferred.
      Currently, both channels record identical data.
      
      Signed-off-by: default avatarCheng-Yi Chiang <cychiang@chromium.org>
      Link: https://lore.kernel.org/r/20190726044202.26866-1-cychiang@chromium.org
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      789e162a
    • Christophe JAILLET's avatar
      ASoC: Intel: Fix some acpi vs apci typo in somme comments · e51b6980
      Christophe JAILLET authored
      
      
      Fix some typo to have the filaname given in a comment match the real name
      of the file.
      Some 'acpi' have erroneously been written 'apci'
      
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Link: https://lore.kernel.org/r/20190725053523.16542-1-christophe.jaillet@wanadoo.fr
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      e51b6980
    • Peter Ujfalusi's avatar
      ASoC: ti: davinci-mcasp: Fix clk PDIR handling for i2s master mode · 34a2a80f
      Peter Ujfalusi authored
      When running McASP as master capture alone will not record any audio unless
      a parallel playback stream is running. As soon as the playback stops the
      captured data is going to be silent again.
      
      In McASP master mode we need to set the PDIR for the clock pins and fix
      the mcasp_set_axr_pdir() to skip the bits in the PDIR registers above
      AMUTE.
      
      This went unnoticed as most of the boards uses McASP as slave and neither
      of these issues are visible (audible) in those setups.
      
      Fixes: ca3d9433
      
       ("ASoC: davinci-mcasp: Update PDIR (pin direction) register handling")
      Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
      Link: https://lore.kernel.org/r/20190725083423.7321-1-peter.ujfalusi@ti.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      34a2a80f
  18. Jul 25, 2019
    • Hui Wang's avatar
      ALSA: hda - Add a conexant codec entry to let mute led work · 3f880949
      Hui Wang authored
      
      
      This conexant codec isn't in the supported codec list yet, the hda
      generic driver can drive this codec well, but on a Lenovo machine
      with mute/mic-mute leds, we need to apply CXT_FIXUP_THINKPAD_ACPI
      to make the leds work. After adding this codec to the list, the
      driver patch_conexant.c will apply THINKPAD_ACPI to this machine.
      
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHui Wang <hui.wang@canonical.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3f880949
    • Takashi Iwai's avatar
      ALSA: hda - Fix intermittent CORB/RIRB stall on Intel chips · 2756d914
      Takashi Iwai authored
      
      
      It turned out that the recent Intel HD-audio controller chips show a
      significant stall during the system PM resume intermittently.  It
      doesn't happen so often and usually it may read back successfully
      after one or more seconds, but in some rare worst cases the driver
      went into fallback mode.
      
      After trial-and-error, we found out that the communication stall seems
      covered by issuing the sync after each verb write, as already done for
      AMD and other chipsets.  So this patch enables the write-sync flag for
      the recent Intel chips, Skylake and onward, as a workaround.
      
      Also, since Broxton and co have the very same driver flags as Skylake,
      refer to the Skylake driver flags instead of defining the same
      contents again for simplification.
      
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=201901
      Reported-and-tested-by: default avatarTodd Brandt <todd.e.brandt@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2756d914
    • Ricard Wanderlof's avatar
      ASoC: Fail card instantiation if DAI format setup fails · 40aa5383
      Ricard Wanderlof authored
      
      
      If the DAI format setup fails, there is no valid communication format
      between CPU and CODEC, so fail card instantiation, rather than continue
      with a card that will most likely not function properly.
      
      Signed-off-by: default avatarRicard Wanderlof <ricardw@axis.com>
      Link: https://lore.kernel.org/r/alpine.DEB.2.20.1907241132350.6338@lnxricardw1.se.axis.com
      Signed-off-by: default avatarMark Brown <broonie@kernel.org>
      40aa5383
  19. Jul 23, 2019