Skip to content
  1. Mar 13, 2018
  2. Mar 12, 2018
  3. Mar 08, 2018
    • Takashi Iwai's avatar
      ALSA: vmaster: Zero-clear ctl before calling slave get · 7a33a02f
      Takashi Iwai authored
      
      
      Use kzalloc() instead of kmalloc() so that we don't need to rely fully
      on the slave get() callback to clear the control value that might be
      copied to user-space.
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7a33a02f
    • Takashi Iwai's avatar
      ALSA: vmaster: Propagate slave error · 2e2c177c
      Takashi Iwai authored
      
      
      In slave_update() of vmaster code ignores the error from the slave
      get() callback and copies the values.  It's not only about the missing
      error code but also that this may potentially lead to a leak of
      uninitialized variables when the slave get() don't clear them.
      
      This patch fixes slave_update() not to copy the potentially
      uninitialized values when an error is returned from the slave get()
      callback, and to propagate the error value properly.
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2e2c177c
  4. Mar 01, 2018
  5. Feb 28, 2018
    • Richard Fitzgerald's avatar
      ALSA: control: Fix a bunch of whitespace errors · dd5f313b
      Richard Fitzgerald authored
      
      
      Remove a bunch of trailing whitespace errors. They are
      fairly annoying if you have your editor set to strip trailing
      whitespace because you find you've introduced more changes
      than you were trying to make.
      
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      dd5f313b
    • Takashi Iwai's avatar
      Merge branch 'for-linus' into for-next · 3b8bd500
      Takashi Iwai authored
      
      
      Back-merge for applying a cleanup to core/control
      
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3b8bd500
    • Richard Fitzgerald's avatar
      ALSA: control: Fix memory corruption risk in snd_ctl_elem_read · 5a23699a
      Richard Fitzgerald authored
      
      
      The patch "ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE
      operations" introduced a potential for kernel memory corruption due
      to an incorrect if statement allowing non-readable controls to fall
      through and call the get function. For TLV controls a driver can omit
      SNDRV_CTL_ELEM_ACCESS_READ to ensure that only the TLV get function
      can be called. Instead the normal get() can be invoked unexpectedly
      and as the driver expects that this will only be called for controls
      <= 512 bytes, potentially try to copy >512 bytes into the 512 byte
      return array, so corrupting kernel memory.
      
      The problem is an attempt to refactor the snd_ctl_elem_read function
      to invert the logic so that it conditionally aborted if the control
      is unreadable instead of conditionally executing. But the if statement
      wasn't inverted correctly.
      
      The correct inversion of
      
          if (a && !b)
      
      is
          if (!a || b)
      
      Fixes: becf9e5d ("ALSA: control: code refactoring for ELEM_READ/ELEM_WRITE operations")
      Signed-off-by: default avatarRichard Fitzgerald <rf@opensource.cirrus.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5a23699a
  6. Feb 27, 2018
  7. Feb 26, 2018
    • Takashi Iwai's avatar
      ALSA: hda - Fix pincfg at resume on Lenovo T470 dock · 71db96dd
      Takashi Iwai authored
      We've added a quirk to enable the recent Lenovo dock support, where it
      overwrites the pin configs of NID 0x17 and 19, not only updating the
      pin config cache.  It works right after the boot, but the problem is
      that the pin configs are occasionally cleared when the machine goes to
      PM.  Meanwhile the quirk writes the pin configs only at the pre-probe,
      so this won't be applied any longer.
      
      For addressing that issue, this patch moves the code to overwrite the
      pin configs into HDA_FIXUP_ACT_INIT section so that it's always
      applied at both probe and resume time.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=195161
      
      
      Fixes: 61fcf8ec ("ALSA: hda/realtek - Enable Thinkpad Dock device for ALC298 platform")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      71db96dd
  8. Feb 24, 2018
  9. Feb 22, 2018
    • Takashi Iwai's avatar
      ALSA: x86: hdmi: Add single_port option for compatible behavior · 7229b12f
      Takashi Iwai authored
      
      
      The recent support for the multiple PCM devices allowed user to use
      multiple HDMI/DP outputs, but at the same time, the PCM stream
      assignment has been changed, too.  Due to that, the former PCM#0
      (there was only one stream in the past) is likely assigned to a
      different one (e.g. PCM#2), and it ends up with the regression when
      user sticks with the fixed configuration using the device#0.
      
      Although the multiple monitor support shouldn't matter when user
      deploys the backend like PulseAudio that checks the jack detection
      state, the behavior change isn't always acceptable for some users.
      
      As a mitigation, this patch introduces an option to switch the
      behavior back to the old-good-days: when the new option,
      single_port=1, is passed, the driver creates only a single PCM device,
      and it's assigned to the first connected one, like the earlier
      versions did.  The option is turned off as default still to support
      the multiple monitors.
      
      Fixes: 8a2d6ae1 ("ALSA: x86: Register multiple PCM devices for the LPE audio card")
      Reported-and-tested-by: default avatarHubert Mantel <mantel@metadox.de>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7229b12f
  10. Feb 20, 2018
  11. Feb 14, 2018
    • Jan-Marek Glogowski's avatar
      ALSA: hda/realtek: PCI quirk for Fujitsu U7x7 · fdcc968a
      Jan-Marek Glogowski authored
      
      
      These laptops have a combined jack to attach headsets, the U727 on
      the left, the U757 on the right, but a headsets microphone doesn't
      work. Using hdajacksensetest I found that pin 0x19 changed the
      present state when plugging the headset, in addition to 0x21, but
      didn't have the correct configuration (shown as "Not connected").
      
      So this sets the configuration to the same values as the headphone
      pin 0x21 except for the device type microphone, which makes it
      work correctly. With the patch the configured pins for U727 are
      
      Pin 0x12 (Internal Mic, Mobile-In): present = No
      Pin 0x14 (Internal Speaker): present = No
      Pin 0x19 (Black Mic, Left side): present = No
      Pin 0x1d (Internal Aux): present = No
      Pin 0x21 (Black Headphone, Left side): present = No
      
      Signed-off-by: default avatarJan-Marek Glogowski <glogow@fbihome.de>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      fdcc968a
    • Takashi Iwai's avatar
      ALSA: seq: Fix racy pool initializations · d15d662e
      Takashi Iwai authored
      
      
      ALSA sequencer core initializes the event pool on demand by invoking
      snd_seq_pool_init() when the first write happens and the pool is
      empty.  Meanwhile user can reset the pool size manually via ioctl
      concurrently, and this may lead to UAF or out-of-bound accesses since
      the function tries to vmalloc / vfree the buffer.
      
      A simple fix is to just wrap the snd_seq_pool_init() call with the
      recently introduced client->ioctl_mutex; as the calls for
      snd_seq_pool_init() from other side are always protected with this
      mutex, we can avoid the race.
      
      Reported-by: default avatar范龙飞 <long7573@126.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      d15d662e
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: add a IOMMU workaround · 04f8773a
      Maciej S. Szmigiero authored
      
      
      The Audigy 2 CA0102 chip (but most likely others from the emu10k1 family,
      too) has a problem that from time to time it likes to do few DMA reads a
      bit beyond its normal allocation and gets very confused if these reads get
      blocked by a IOMMU.
      
      For the first (reserved) page this happens multiple times at every
      playback, for various synth pages it happens randomly, rarely for PCM
      playback buffers and the page table memory itself.
      All these reads seem to follow a similar pattern, observed read offsets
      beyond the allocation end were 0x00, 0x40, 0x80 and 0xc0 (PCI cache line
      multiples), so it looks like the device tries to accesses up to 256 extra
      bytes.
      
      As a workaround let's widen these DMA allocations by an extra page if we
      detect that the device is behind a non-passthrough IOMMU (the DMA memory
      should be relatively plenty on IOMMU systems).
      
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      04f8773a
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: make sure synth DMA pages are allocated with DMA functions · 055e0ae1
      Maciej S. Szmigiero authored
      
      
      Commit a5003fc0 ("[ALSA] emu10k1 - simplify page allocation for synth")
      switched from using the DMA allocator for synth DMA pages to manually
      calling alloc_page().
      However, this usage has an implicit assumption that the DMA address space
      for the emu10k1-family chip is the same as the CPU physical address space
      which is not true for a system with a IOMMU.
      
      Since this made the synth part of the driver non-functional on such systems
      let's effectively revert that commit (while keeping the
      __synth_free_pages() simplification).
      
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      055e0ae1
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: add optional debug printouts with DMA addresses · 541b9bad
      Maciej S. Szmigiero authored
      
      
      When we get a IOMMU page fault for a emu10k1 device it is very hard to
      discover which of chip many DMA allocations triggered it (since on a IOMMU
      system the DMA address space is often very different from the CPU one).
      Let's add optional debug printouts providing this information.
      
      These debug printouts are only enabled on an explicit request via the
      kernel dynamic debug mechanism.
      
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      541b9bad
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: use dma_set_mask_and_coherent() · 70d0bc7d
      Maciej S. Szmigiero authored
      
      
      We have been calling dma_set_mask() and then dma_set_coherent_mask() with
      the same value, but there is a dma_set_mask_and_coherent() function that
      does exactly that so let's use it instead.
      
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      70d0bc7d
    • Maciej S. Szmigiero's avatar
      ALSA: emu10k1: remove reserved_page · a4463c92
      Maciej S. Szmigiero authored
      
      
      The emu10k1-family chips need the first page (index 0) reserved in their
      page tables for some reason (every emu10k1 driver I've checked does this
      without much of an explanation).
      Using the first page for normal samples results in a broken playback.
      
      However, we already have a dummy page allocated - so called "silent page"
      and, in fact, had always been setting it as the first page in the chip page
      table because an initialization of every entry of the page table to point
      to a silent page happens after and overwrites the reserved_page allocation.
      
      So the only thing remaining to remove the reserved_page allocation is a
      trivial change to the page allocation logic to ignore the first page entry
      and start its allocations from the second entry (index 1).
      
      Signed-off-by: default avatarMaciej S. Szmigiero <mail@maciej.szmigiero.name>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      a4463c92
  12. Feb 12, 2018
  13. Feb 11, 2018