1. 11 Dec, 2018 5 commits
    • Takashi Iwai's avatar
      ASoC: hdac_hdmi: Add missing display power-off at driver removal · 77a49672
      Takashi Iwai authored
      The display power is in unbalance at removing the driver since it
      misses the snd_hdac_display_power(OFF) call.
      Acked-by: default avatarMark Brown <broonie@kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      77a49672
    • Takashi Iwai's avatar
      ALSA: hda: Make snd_hdac_display_power() void function · 4f799e73
      Takashi Iwai authored
      After the recent refactoring, snd_hdac_display_power() doesn't return
      any error, hence it can be defined to return void.
      This makes many error checks redundant and allows us to reduce them
      gracefully.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      4f799e73
    • Takashi Iwai's avatar
      ALSA: hda/intel: Properly free the display power at error path · 457f3c86
      Takashi Iwai authored
      When an error occurs in azx_probe_continue(), we should release the
      display power.  However, the current code ignores it and releases the
      display power only for HSW/BDW cases.  Fix it.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      457f3c86
    • Takashi Iwai's avatar
      ALSA: hda/intel: Drop superfluous AZX_DCAPS_I915_POWERWELL checks · e454ff8e
      Takashi Iwai authored
      snd_hdac_display_power() can be called even for a HDA controller
      without DRM binding.  The same is true for other helpers,
      snd_hdac_i915_set_bclk() and snd_hdac_set_codec_wakeup().
      So all superfluous AZX_DCAPS_I915_POWERWELL  checks in hda_intel.c can
      be dropped, and the definition of AZX_DCAPS_I915_POWERWELL itself can
      be removed as well.  This simplifies the code a lot.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e454ff8e
    • Takashi Iwai's avatar
      ALSA: hda: Refactor display power management · 029d92c2
      Takashi Iwai authored
      The current HD-audio code manages the DRM audio power via too complex
      redirections, and this seems even still unbalanced in a corner case as
      Intel DRM CI has been intermittently reporting.  This patch is a big
      surgery for addressing the complexity and the possible unbalance.
      
      Basically the patch changes the display PM in the following ways:
      
      - Both HD-audio controller and codec drivers call a single helper,
        snd_hdac_display_power().  (Formerly, the display power control from
        a codec was done indirectly via link_power bus ops.)
      
      - snd_hdac_display_power() receives the codec address index.  For
        turning on/off from the controller, pass HDA_CODEC_IDX_CONTROLLER.
      
      - snd_hdac_display_power() doesn't manage refcounts any longer, but
        keeps the power status in bitmap.  If any of controller or codecs is
        turned on, the function updates the DRM power state via get_power()
        or put_power().
      
      Also this refactor allows us more cleanup:
      
      - The link_power bus ops is dropped, so there is no longer indirect
        management, as mentioned in the above.
      
      - hdac_device link_power_control flag is moved to hda_codec
        display_power_control flag, as it's only for HDA legacy.
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=106525Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      029d92c2
  2. 09 Dec, 2018 3 commits
  3. 07 Dec, 2018 1 commit
  4. 05 Dec, 2018 4 commits
  5. 03 Dec, 2018 2 commits
    • Hui Peng's avatar
      ALSA: usb-audio: Fix UAF decrement if card has no live interfaces in card.c · 5f8cf712
      Hui Peng authored
      If a USB sound card reports 0 interfaces, an error condition is triggered
      and the function usb_audio_probe errors out. In the error path, there was a
      use-after-free vulnerability where the memory object of the card was first
      freed, followed by a decrement of the number of active chips. Moving the
      decrement above the atomic_dec fixes the UAF.
      
      [ The original problem was introduced in 3.1 kernel, while it was
        developed in a different form.  The Fixes tag below indicates the
        original commit but it doesn't mean that the patch is applicable
        cleanly. -- tiwai ]
      
      Fixes: 362e4e49 ("ALSA: usb-audio - clear chip->probing on error exit")
      Reported-by: default avatarHui Peng <benquike@gmail.com>
      Reported-by: default avatarMathias Payer <mathias.payer@nebelwelt.net>
      Signed-off-by: default avatarHui Peng <benquike@gmail.com>
      Signed-off-by: default avatarMathias Payer <mathias.payer@nebelwelt.net>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5f8cf712
    • Takashi Iwai's avatar
      ALSA: hda/realtek - Fix speaker output regression on Thinkpad T570 · 54947cd6
      Takashi Iwai authored
      We've got a regression report for some Thinkpad models (at least
      T570s) which shows the too low speaker output volume.  The bisection
      leaded to the commit 61fcf8ec ("ALSA: hda/realtek - Enable Thinkpad
      Dock device for ALC298 platform"), and it's basically adding the two
      pin configurations for the dock, and looks harmless.
      
      The real culprit seems, though, that the DAC assignment for the
      speaker pin is implicitly assumed on these devices, i.e. pin NID 0x14
      to be coupled with DAC NID 0x03.  When more pins are configured by the
      commit above, the auto-parser changes the DAC assignment, and this
      resulted in the regression.
      
      As a workaround, just provide the fixed pin / DAC mapping table for
      this Thinkpad fixup function.  It's no generic solution, but the
      problem itself is pretty much device-specific, so must be good
      enough.
      
      Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1554304
      Fixes: 61fcf8ec ("ALSA: hda/realtek - Enable Thinkpad Dock device for ALC298 platform")
      Cc: <stable@vger.kernel.org>
      Reported-and-tested-by: default avatarJeremy Cline <jcline@redhat.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      54947cd6
  6. 29 Nov, 2018 5 commits
    • Takashi Iwai's avatar
      ALSA: pcm: Fix interval evaluation with openmin/max · 5363857b
      Takashi Iwai authored
      As addressed in alsa-lib (commit b420056604f0), we need to fix the
      case where the evaluation of PCM interval "(x x+1]" leading to
      -EINVAL.  After applying rules, such an interval may be translated as
      "(x x+1)".
      
      Fixes: ff2d6acd ("ALSA: pcm: Fix snd_interval_refine first/last with open min/max")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      5363857b
    • Kai-Heng Feng's avatar
      ALSA: hda: Add support for AMD Stoney Ridge · 3deef52c
      Kai-Heng Feng authored
      It's similar to other AMD audio devices, it also supports D3, which can
      save some power drain.
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3deef52c
    • Tony Das's avatar
      ALSA: usb-audio: Add SMSL D1 to quirks for native DSD support · 44ff57e6
      Tony Das authored
      This patch adds quirk VID/PID IDs for the SMSL D1 in order to enable
      Native DSD support.
      
      [ Moved the added entry in numerical order -- tiwai ]
      Signed-off-by: default avatarTony Das <tdas444@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      44ff57e6
    • Chanho Min's avatar
      ALSA: pcm: Fix starvation on down_write_nonblock() · b888a5f7
      Chanho Min authored
      Commit 67ec1072 ("ALSA: pcm: Fix rwsem deadlock for non-atomic PCM
      stream") fixes deadlock for non-atomic PCM stream. But, This patch
      causes antother stuck.
      If writer is RT thread and reader is a normal thread, the reader
      thread will be difficult to get scheduled. It may not give chance to
      release readlocks and writer gets stuck for a long time if they are
      pinned to single cpu.
      
      The deadlock described in the previous commit is because the linux
      rwsem queues like a FIFO. So, we might need non-FIFO writelock, not
      non-block one.
      
      My suggestion is that the writer gives reader a chance to be scheduled
      by using the minimum msleep() instaed of spinning without blocking by
      writer. Also, The *_nonblock may be changed to *_nonfifo appropriately
      to this concept.
      In terms of performance, when trylock is failed, this minimum periodic
      msleep will have the same performance as the tick-based
      schedule()/wake_up_q().
      
      [ Although this has a fairly high performance penalty, the relevant
        code path became already rare due to the previous commit ("ALSA:
        pcm: Call snd_pcm_unlink() conditionally at closing").  That is, now
        this unconditional msleep appears only when using linked streams,
        and this must be a rare case.  So we accept this as a quick
        workaround until finding a more suitable one -- tiwai ]
      
      Fixes: 67ec1072 ("ALSA: pcm: Fix rwsem deadlock for non-atomic PCM stream")
      Suggested-by: default avatarWonmin Jung <wonmin.jung@lge.com>
      Signed-off-by: default avatarChanho Min <chanho.min@lge.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b888a5f7
    • Takashi Iwai's avatar
      ALSA: pcm: Call snd_pcm_unlink() conditionally at closing · b51abed8
      Takashi Iwai authored
      Currently the PCM core calls snd_pcm_unlink() always unconditionally
      at closing a stream.  However, since snd_pcm_unlink() invokes the
      global rwsem down, the lock can be easily contended.  More badly, when
      a thread runs in a high priority RT-FIFO, it may stall at spinning.
      
      Basically the call of snd_pcm_unlink() is required only for the linked
      streams that are already rare occasion.  For normal use cases, this
      code path is fairly superfluous.
      
      As an optimization (and also as a workaround for the RT problem
      above in normal situations without linked streams), this patch adds a
      check before calling snd_pcm_unlink() and calls it only when needed.
      Reported-by: default avatarChanho Min <chanho.min@lge.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b51abed8
  7. 28 Nov, 2018 1 commit
  8. 27 Nov, 2018 3 commits
  9. 26 Nov, 2018 1 commit
  10. 24 Nov, 2018 3 commits
    • Takashi Iwai's avatar
      ALSA: control: Fix race between adding and removing a user element · e1a7bfe3
      Takashi Iwai authored
      The procedure for adding a user control element has some window opened
      for race against the concurrent removal of a user element.  This was
      caught by syzkaller, hitting a KASAN use-after-free error.
      
      This patch addresses the bug by wrapping the whole procedure to add a
      user control element with the card->controls_rwsem, instead of only
      around the increment of card->user_ctl_count.
      
      This required a slight code refactoring, too.  The function
      snd_ctl_add() is split to two parts: a core function to add the
      control element and a part calling it.  The former is called from the
      function for adding a user control element inside the controls_rwsem.
      
      One change to be noted is that snd_ctl_notify() for adding a control
      element gets called inside the controls_rwsem as well while it was
      called outside the rwsem.  But this should be OK, as snd_ctl_notify()
      takes another (finer) rwlock instead of rwsem, and the call of
      snd_ctl_notify() inside rwsem is already done in another code path.
      
      Reported-by: syzbot+dc09047bce3820621ba2@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e1a7bfe3
    • Takashi Iwai's avatar
      ALSA: sparc: Fix invalid snd_free_pages() at error path · 9a20332a
      Takashi Iwai authored
      Some spurious calls of snd_free_pages() have been overlooked and
      remain in the error paths of sparc cs4231 driver code.  Since
      runtime->dma_area is managed by the PCM core helper, we shouldn't
      release manually.
      
      Drop the superfluous calls.
      Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      9a20332a
    • Takashi Iwai's avatar
      ALSA: wss: Fix invalid snd_free_pages() at error path · 7b691541
      Takashi Iwai authored
      Some spurious calls of snd_free_pages() have been overlooked and
      remain in the error paths of wss driver code.  Since runtime->dma_area
      is managed by the PCM core helper, we shouldn't release manually.
      
      Drop the superfluous calls.
      Reviewed-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7b691541
  11. 23 Nov, 2018 6 commits
  12. 20 Nov, 2018 2 commits
  13. 19 Nov, 2018 3 commits
  14. 15 Nov, 2018 1 commit