1. 06 May, 2019 2 commits
  2. 03 May, 2019 1 commit
  3. 30 Apr, 2019 2 commits
    • Takashi Iwai's avatar
      ALSA: hda/realtek - Apply the fixup for ASUS Q325UAR · 3887c26c
      Takashi Iwai authored
      Some ASUS models like Q325UAR with ALC295 codec requires the same
      fixup that has been applied to ALC294 codec.  Just copy the entry with
      the pin matching to cover ALC295 too.
      
      BugLink: https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1784485
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      3887c26c
    • Takashi Iwai's avatar
      ALSA: hda - Register irq handler after the chip initialization · f495222e
      Takashi Iwai authored
      Currently the IRQ handler in HD-audio controller driver is registered
      before the chip initialization.  That is, we have some window opened
      between the azx_acquire_irq() call and the CORB/RIRB setup.  If an
      interrupt is triggered in this small window, the IRQ handler may
      access to the uninitialized RIRB buffer, which leads to a NULL
      dereference Oops.
      
      This is usually no big problem since most of Intel chips do register
      the IRQ via MSI, and we've already fixed the order of the IRQ
      enablement and the CORB/RIRB setup in the former commit b61749a8
      ("sound: enable interrupt after dma buffer initialization"), hence the
      IRQ won't be triggered in that room.  However, some platforms use a
      shared IRQ, and this may allow the IRQ trigger by another source.
      
      Another possibility is the kdump environment: a stale interrupt might
      be present in there, the IRQ handler can be falsely triggered as well.
      
      For covering this small race, let's move the azx_acquire_irq() call
      after hda_intel_init_chip() call.  Although this is a bit radical
      change, it can cover more widely than checking the CORB/RIRB setup
      locally in the callee side.
      Reported-by: default avatarLiwei Song <liwei.song@windriver.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f495222e
  4. 29 Apr, 2019 3 commits
    • Wenwen Wang's avatar
      ALSA: usx2y: fix a double free bug · cbb88db7
      Wenwen Wang authored
      In usX2Y_In04_init(), a new urb is firstly created through usb_alloc_urb()
      and saved to 'usX2Y->In04urb'. Then, a buffer is allocated through
      kmalloc() and saved to 'usX2Y->In04Buf'. If the allocation of the buffer
      fails, the error code ENOMEM is returned after usb_free_urb(), which frees
      the created urb. However, the urb is actually freed at card->private_free
      callback, i.e., snd_usX2Y_card_private_free(). So the free operation here
      leads to a double free bug.
      
      To fix the above issue, simply remove usb_free_urb().
      Signed-off-by: default avatarWenwen Wang <wang6495@umn.edu>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      cbb88db7
    • Bard liao's avatar
      ASoC: hdac_hda: overwrite hdev type to HDA_DEV_ASOC · b60ee2e2
      Bard liao authored
      In ASoC driver, snd_hdac_device_register() will be called by
      snd_hdac_ext_bus_device_init() and snd_hdac_device_unregister()
      will called by snd_hdac_ext_bus_device_remove(). However when
      ASoC codec driver call snd_hda_codec_device_new() to create a
      new hda codec, it will assign snd_hda_codec_dev_free() to the
      dev_free ops and snd_hda_codec_dev_free() will call
      snd_hdac_device_unregister(). As a result, snd_hdac_device_unregister()
      will be called twice in ASoC driver. To prevent it, we use hdev
      type to determine if the hda codec is registered by legacy HDA
      driver or ASoC driver and unregister device in  snd_hda_codec_dev_free()
      only if it is a legacy HDA device.
      This patch will overwrite the hdev type so that we can know it is
      a ASoC device.
      Signed-off-by: default avatarBard liao <yung-chuan.liao@linux.intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b60ee2e2
    • Bard liao's avatar
      ALSA: hda: fix unregister device twice on ASoC driver · 4d95c517
      Bard liao authored
      snd_hda_codec_device_new() is used by both legacy HDA and ASoC
      driver. However, we will call snd_hdac_device_unregister() in
      snd_hdac_ext_bus_device_remove() for ASoC device. This patch uses
      the type flag in hdac_device struct to determine is it a ASoC device
      or legacy HDA device and call snd_hdac_device_unregister() in
      snd_hda_codec_dev_free() only if it is a legacy HDA device.
      Signed-off-by: default avatarBard liao <yung-chuan.liao@linux.intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      4d95c517
  5. 28 Apr, 2019 5 commits
  6. 24 Apr, 2019 2 commits
  7. 17 Apr, 2019 4 commits
  8. 16 Apr, 2019 2 commits
    • Takashi Iwai's avatar
      ALSA: core: Fix card races between register and disconnect · 2a3f7221
      Takashi Iwai authored
      There is a small race window in the card disconnection code that
      allows the registration of another card with the very same card id.
      This leads to a warning in procfs creation as caught by syzkaller.
      
      The problem is that we delete snd_cards and snd_cards_lock entries at
      the very beginning of the disconnection procedure.  This makes the
      slot available to be assigned for another card object while the
      disconnection procedure is being processed.  Then it becomes possible
      to issue a procfs registration with the existing file name although we
      check the conflict beforehand.
      
      The fix is simply to move the snd_cards and snd_cards_lock clearances
      at the end of the disconnection procedure.  The references to these
      entries are merely either from the global proc files like
      /proc/asound/cards or from the card registration / disconnection, so
      it should be fine to shift at the very end.
      
      Reported-by: syzbot+48df349490c36f9f54ab@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2a3f7221
    • Takashi Iwai's avatar
      ALSA: info: Fix racy addition/deletion of nodes · 8c2f8708
      Takashi Iwai authored
      The ALSA proc helper manages the child nodes in a linked list, but its
      addition and deletion is done without any lock.  This leads to a
      corruption if they are operated concurrently.  Usually this isn't a
      problem because the proc entries are added sequentially in the driver
      probe procedure itself.  But the card registrations are done often
      asynchronously, and the crash could be actually reproduced with
      syzkaller.
      
      This patch papers over it by protecting the link addition and deletion
      with the parent's mutex.  There is "access" mutex that is used for the
      file access, and this can be reused for this purpose as well.
      
      Reported-by: syzbot+48df349490c36f9f54ab@syzkaller.appspotmail.com
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      8c2f8708
  9. 15 Apr, 2019 2 commits
    • Takashi Iwai's avatar
      ALSA: seq: Correct unlock sequence at snd_seq_client_ioctl_unlock() · b5fd12d6
      Takashi Iwai authored
      The doubly unlock sequence at snd_seq_client_ioctl_unlock() is tricky.
      I took a direct unref call since I thought it would avoid
      misunderstanding, but rather this seems more confusing.  Let's use
      snd_seq_client_unlock() consistently even if they look strange to be
      called twice, and add more comments for avoiding reader's confusion.
      
      Fixes: 6b580f52 ("ALSA: seq: Protect racy pool manipulation from OSS sequencer")
      Reviewed-by: default avatarKai Vehmanen <kai.vehmanen@linux.intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      b5fd12d6
    • Roope Salmi's avatar
      ALSA: usb-audio: Add quirk for Focusrite Scarlett Solo · 46f5710f
      Roope Salmi authored
      The device reports Synch: Synchronous on the playback interface.
      This causes regular audible napping on sample rates that are not multiples
      of 1 kHz. Fix to Synch: Asynchronous.
      
      Specifically observed on Focusrite Scarlett Solo 2nd generation. I assume
      the first generation model has a different device ID. A first generation
      Scarlett 2i2 I was able to test advertised Synch: Asynchronous by default.
      
      For example, with a sample rate of 44100 Hz, a silent sample is played
      every 40.96 seconds (likely 44.0 samples instead of 44.1 transmitted per
      USB frame on average, 4096 being the size of some internal buffer).
      There may be some other bug at play here since this doesn't happen
      on other platforms. However, a feedback endpoint is listed and using it
      fixes the issue. That is the only change in the quirk,
      but I didn't find a way to declare only it.
      
      Tested on two units and on two different computers.
      Signed-off-by: default avatarRoope Salmi <rpsalmi@gmail.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      46f5710f
  10. 13 Apr, 2019 3 commits
  11. 12 Apr, 2019 3 commits
    • Takashi Iwai's avatar
      ALSA: seq: Protect racy pool manipulation from OSS sequencer · 6b580f52
      Takashi Iwai authored
      OSS sequencer emulation still allows to queue and issue the events
      that manipulate the client pool concurrently in a racy way.  This
      patch serializes the access like the normal sequencer write / ioctl
      via taking the client ioctl_mutex.  Since the access to the sequencer
      client is done indirectly via a client id number, a new helper to
      take/release the mutex is introduced.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6b580f52
    • Takashi Iwai's avatar
      ALSA: seq: Simplify snd_seq_kernel_client_enqueue() helper · 6740ea67
      Takashi Iwai authored
      We have two helpers for queuing a sequencer event from the kernel
      client, and both are used only from OSS sequencer layer without any
      hop and atomic set.  Let's simplify and unify two helpers into one.
      
      No functional change, just a call pattern change.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6740ea67
    • Takashi Iwai's avatar
      ALSA: seq: Cover unsubscribe_port() in list_mutex · 7c32ae35
      Takashi Iwai authored
      The call of unsubscribe_port() which manages the group count and
      module refcount from delete_and_unsubscribe_port() looks racy; it's
      not covered by the group list lock, and it's likely a cause of the
      reported unbalance at port deletion.  Let's move the call inside the
      group list_mutex to plug the hole.
      
      Reported-by: syzbot+e4c8abb920efa77bace9@syzkaller.appspotmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      7c32ae35
  12. 11 Apr, 2019 2 commits
    • Takashi Iwai's avatar
      Revert "ALSA: seq: Protect in-kernel ioctl calls with mutex" · f0654ba9
      Takashi Iwai authored
      This reverts commit feb68902.
      
      The fix attempt was incorrect, leading to the mutex deadlock through
      the close of OSS sequencer client.  The proper fix needs more
      consideration, so let's revert it now.
      
      Fixes: feb68902 ("ALSA: seq: Protect in-kernel ioctl calls with mutex")
      Reported-by: syzbot+47ded6c0f23016cde310@syzkaller.appspotmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f0654ba9
    • Takashi Iwai's avatar
      Merge tag 'asoc-fix-v5.1-rc4' of... · 9b0dcd0e
      Takashi Iwai authored
      Merge tag 'asoc-fix-v5.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-linus
      
      ASoC: Fixes for v5.1
      
      A few core fixes along with the driver specific ones, mainly fixing
      small issues that only affect x86 platforms for various reasons (their
      unusual machine enumeration mechanisms mainly, plus a fix for error
      handling in topology).
      
      There's some of the driver fixes that look larger than they are, like
      the hdmi-codec changes which resulted in an indentation change, and most
      of the other large changes are for new drivers like the STM32 changes.
      9b0dcd0e
  13. 10 Apr, 2019 7 commits
  14. 09 Apr, 2019 2 commits
    • Takashi Iwai's avatar
      ALSA: seq: Fix race of get-subscription call vs port-delete ioctls · 2eabc5ec
      Takashi Iwai authored
      The snd_seq_ioctl_get_subscription() retrieves the port subscriber
      information as a pointer, while the object isn't protected, hence it
      may be deleted before the actual reference.  This race was spotted by
      syzkaller and may lead to a UAF.
      
      The fix is simply copying the data in the lookup function that
      performs in the rwsem to protect against the deletion.
      
      Reported-by: syzbot+9437020c82413d00222d@syzkaller.appspotmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2eabc5ec
    • Takashi Iwai's avatar
      ALSA: seq: Protect in-kernel ioctl calls with mutex · feb68902
      Takashi Iwai authored
      ALSA OSS sequencer calls the ioctl function indirectly via
      snd_seq_kernel_client_ctl().  While we already applied the protection
      against races between the normal ioctls and writes via the client's
      ioctl_mutex, this code path was left untouched.  And this seems to be
      the cause of still remaining some rare UAF as spontaneously triggered
      by syzkaller.
      
      For the sake of robustness, wrap the ioctl_mutex also for the call via
      snd_seq_kernel_client_ctl(), too.
      
      Reported-by: syzbot+e4c8abb920efa77bace9@syzkaller.appspotmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      feb68902