1. 13 Apr, 2019 3 commits
  2. 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
  3. 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
  4. 10 Apr, 2019 7 commits
  5. 09 Apr, 2019 6 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
    • Takashi Iwai's avatar
      ALSA: seq: Remove superfluous irqsave flags · f823b8a7
      Takashi Iwai authored
      spin_lock_irqsave() is used unnecessarily in various places in
      sequencer core code although it's pretty obvious that the context is
      sleepable.  Remove irqsave and use the plain spin_lock_irq() in such
      places for simplicity.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f823b8a7
    • Takashi Iwai's avatar
      ALSA: seq: Align temporary re-locking with irqsave version · 4b24b960
      Takashi Iwai authored
      In a few places in sequencer core, we temporarily unlock / re-lock the
      pool spin lock while waiting for the allocation in the blocking mode.
      There spin_unlock_irq() / spin_lock_irq() pairs are called while
      initially spin_lock_irqsave() is used (and spin_lock_irqrestore() at
      the end of the function again).  This is likely OK for now, but it's a
      bit confusing and error-prone.
      
      This patch replaces these temporary relocking lines with the irqsave
      variant to make the lock/unlock sequence more consistently.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      4b24b960
    • Takashi Iwai's avatar
      ALSA: seq: Use kvmalloc() for cell pools · fd7ae83d
      Takashi Iwai authored
      Use kvmalloc() for allocating cell pools since the pool size can be
      relatively small that may be covered better by slab.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      fd7ae83d
    • Takashi Iwai's avatar
      ALSA: timer: Revert active callback sync check at close · df55531b
      Takashi Iwai authored
      This is essentially a revert of the commit a7588c89 ("ALSA: timer:
      Check ack_list emptiness instead of bit flag").  The intended change
      by the commit turns out to be insufficient, as snd_timer_close*()
      always calls snd_timer_stop() that deletes the ack_list beforehand.
      
      In theory, we can change the behavior of snd_timer_stop() to sync the
      pending ack_list, but this will become a deadlock for the callback
      like sequencer that calls again snd_timer_stop() from itself.  So,
      reverting the change is a more straightforward solution.
      
      Fixes: a7588c89 ("ALSA: timer: Check ack_list emptiness instead of bit flag")
      Reported-by: syzbot+58813d77154713f4de15@syzkaller.appspotmail.com
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      df55531b
  6. 08 Apr, 2019 5 commits
  7. 05 Apr, 2019 3 commits
  8. 04 Apr, 2019 6 commits
  9. 03 Apr, 2019 5 commits