1. 03 6月, 2017 5 次提交
  2. 31 5月, 2017 1 次提交
  3. 30 5月, 2017 1 次提交
    • B
      ALSA: declare snd_kcontrol_new structures as const · 905e46ac
      Bhumika Goyal 提交于
      Declare snd_kcontrol_new structures as const as they are only passed an
      argument to the function snd_ctl_new1. This argument is of type const,
      so snd_kcontrol_new structures having this property can be made const.
      Done using Coccinelle:
      
      @r disable optional_qualifier@
      identifier x;
      position p;
      @@
      static struct snd_kcontrol_new x@p={...};
      
      @ok@
      identifier r.x;
      position p;
      @@
      snd_ctl_new1(&x@p,...)
      
      @bad@
      position p != {r.p,ok.p};
      identifier r.x;
      @@
      x@p
      
      @depends on !bad disable optional_qualifier@
      identifier r.x;
      @@
      +const
      struct snd_kcontrol_new x;
      
      Cross compiled these files:
      sound/aoa/codecs/tas.c - powerpc
      sound/mips/{hal2.c/sgio2audio.c} - mips
      sound/ppc/{awacs.c/beep.c/tumbler.c} - powerpc
      sound/soc/sh/siu_dai.c - sh
      Could not find an architecture to compile sound/sh/aica.c.
      Signed-off-by: NBhumika Goyal <bhumirks@gmail.com>
      Acked-by: NMark Brown <broonie@kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      905e46ac
  4. 26 5月, 2017 2 次提交
    • T
      ALSA: pcm: add local header file for snd-pcm module · 2c4842d3
      Takashi Sakamoto 提交于
      Several files are used to construct PCM core module, a.k.a snd-pcm.
      Although available APIs are described in 'include/sound/pcm.h', some of
      them are not exported as symbols in kernel space. Such APIs are just for
      module local usage.
      
      This commit adds module local header file and move some function prototypes
      into it so that scopes of them are controlled properly and developers
      get no confusion from unavailable symbols.
      Signed-off-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      2c4842d3
    • T
      ALSA: pcm: Call ack() whenever appl_ptr is updated · 9027c463
      Takashi Iwai 提交于
      Although the ack callback is supposed to be called at each appl_ptr or
      hw_ptr update, we missed a few opportunities: namely, forward, rewind
      and sync_ptr.
      
      Formerly calling ack at rewind may have leaded to unexpected results
      due to the forgotten negative appl_ptr update in indirect-PCM helper,
      which is the major user of the PCM ack callback.  But now we fixed
      this oversights, thus we can call ack callback safely even at rewind
      callback -- of course with the proper handling of the error from the
      callback.
      
      This patch adds the calls of ack callback in the places mentioned in
      the above.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      9027c463
  5. 24 5月, 2017 1 次提交
  6. 23 5月, 2017 3 次提交
    • T
      ALSA: info: Use kvzalloc() for a temporary write buffer · ffb73b08
      Takashi Iwai 提交于
      We used to use kmalloc (more exactly, krealloc()) for creating and
      growing the temporary buffer for text proc write.  It can grow up to
      16kB, and it's already a bit doubtful whether it's always safe to use
      kmalloc().  With the recent addition of kvmalloc(), we can have a
      better chance for succeed of memory allocation, so let's switch to
      that new API.
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      ffb73b08
    • T
      ALSA: pcm: Remove set_fs() in PCM core code · c2c86a97
      Takashi Iwai 提交于
      PCM core code has a few usages of set_fs(), mostly for two codepaths:
      - The DELAY ioctl call from pcm_compat.c
      - The ioctl wrapper in kernel context for PCM OSS and other
      
      This patch removes the set_fs() usage in these places by a slight code
      refactoring.  For the former point, snd_pcm_delay() is changed to
      return the  value directly instead of putting the value to the given
      address.  Each caller stores the result in an appropriate manner.
      
      For fixing the latter, snd_pcm_lib_kernel_ioctl() is changed to call
      the functions directly as well.  For achieving it, now the function
      accepts only the limited set of ioctls that have been used, so far.
      The primary user of this function is the PCM OSS layer, and the only
      other user is USB UAC1 gadget driver.  Both drivers don't need the
      full set of ioctls.
      Reviewed-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      c2c86a97
    • T
      ALSA: control: Simplify snd_ctl_elem_list() implementation · 53e7bf45
      Takashi Iwai 提交于
      This patch simplifies the code of snd_ctl_elem_list() in the following
      ways:
      
      - Avoid a vmalloc() temporary buffer but do copy in each iteration;
        the vmalloc buffer was introduced at the time we took the spinlock
        for the ctl element management.
      
      - Use the standard list_for_each_entry() macro
      
      - Merge two loops into one;
        it used to be a loop for skipping until offset becomes zero and
        another loop to copy the data.  They can be folded into a single
        loop easily.
      Reviewed-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Tested-by: NTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      53e7bf45
  7. 21 5月, 2017 2 次提交
  8. 18 5月, 2017 2 次提交
  9. 17 5月, 2017 5 次提交
  10. 13 4月, 2017 1 次提交
    • T
      ALSA: seq: Don't break snd_use_lock_sync() loop by timeout · 4e7655fd
      Takashi Iwai 提交于
      The snd_use_lock_sync() (thus its implementation
      snd_use_lock_sync_helper()) has the 5 seconds timeout to break out of
      the sync loop.  It was introduced from the beginning, just to be
      "safer", in terms of avoiding the stupid bugs.
      
      However, as Ben Hutchings suggested, this timeout rather introduces a
      potential leak or use-after-free that was apparently fixed by the
      commit 2d7d5400 ("ALSA: seq: Fix race during FIFO resize"):
      for example, snd_seq_fifo_event_in() -> snd_seq_event_dup() ->
      copy_from_user() could block for a long time, and snd_use_lock_sync()
      goes timeout and still leaves the cell at releasing the pool.
      
      For fixing such a problem, we remove the break by the timeout while
      still keeping the warning.
      Suggested-by: NBen Hutchings <ben.hutchings@codethink.co.uk>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4e7655fd
  11. 31 3月, 2017 2 次提交
  12. 25 3月, 2017 1 次提交
    • T
      ALSA: seq: Fix race during FIFO resize · 2d7d5400
      Takashi Iwai 提交于
      When a new event is queued while processing to resize the FIFO in
      snd_seq_fifo_clear(), it may lead to a use-after-free, as the old pool
      that is being queued gets removed.  For avoiding this race, we need to
      close the pool to be deleted and sync its usage before actually
      deleting it.
      
      The issue was spotted by syzkaller.
      Reported-by: NDmitry Vyukov <dvyukov@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      2d7d5400
  13. 21 3月, 2017 1 次提交
  14. 02 3月, 2017 1 次提交
  15. 01 3月, 2017 1 次提交
    • T
      ALSA: seq: Fix link corruption by event error handling · f3ac9f73
      Takashi Iwai 提交于
      The sequencer FIFO management has a bug that may lead to a corruption
      (shortage) of the cell linked list.  When a sequencer client faces an
      error at the event delivery, it tries to put back the dequeued cell.
      When the first queue was put back, this forgot the tail pointer
      tracking, and the link will be screwed up.
      
      Although there is no memory corruption, the sequencer client may stall
      forever at exit while flushing the pending FIFO cells in
      snd_seq_pool_done(), as spotted by syzkaller.
      
      This patch addresses the missing tail pointer tracking at
      snd_seq_fifo_cell_putback().  Also the patch makes sure to clear the
      cell->enxt pointer at snd_seq_fifo_event_in() for avoiding a similar
      mess-up of the FIFO linked list.
      Reported-by: NDmitry Vyukov <dvyukov@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      f3ac9f73
  16. 28 2月, 2017 1 次提交
    • T
      ALSA: timer: Reject user params with too small ticks · 71321eb3
      Takashi Iwai 提交于
      When a user sets a too small ticks with a fine-grained timer like
      hrtimer, the kernel tries to fire up the timer irq too frequently.
      This may lead to the condensed locks, eventually the kernel spinlock
      lockup with warnings.
      
      For avoiding such a situation, we define a lower limit of the
      resolution, namely 1ms.  When the user passes a too small tick value
      that results in less than that, the kernel returns -EINVAL now.
      Reported-by: NDmitry Vyukov <dvyukov@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      71321eb3
  17. 25 2月, 2017 1 次提交
  18. 08 2月, 2017 1 次提交
    • T
      ALSA: seq: Fix race at creating a queue · 4842e98f
      Takashi Iwai 提交于
      When a sequencer queue is created in snd_seq_queue_alloc(),it adds the
      new queue element to the public list before referencing it.  Thus the
      queue might be deleted before the call of snd_seq_queue_use(), and it
      results in the use-after-free error, as spotted by syzkaller.
      
      The fix is to reference the queue object at the right time.
      Reported-by: NDmitry Vyukov <dvyukov@google.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      4842e98f
  19. 06 2月, 2017 1 次提交
  20. 12 1月, 2017 2 次提交
  21. 26 12月, 2016 1 次提交
    • T
      ktime: Get rid of the union · 2456e855
      Thomas Gleixner 提交于
      ktime is a union because the initial implementation stored the time in
      scalar nanoseconds on 64 bit machine and in a endianess optimized timespec
      variant for 32bit machines. The Y2038 cleanup removed the timespec variant
      and switched everything to scalar nanoseconds. The union remained, but
      become completely pointless.
      
      Get rid of the union and just keep ktime_t as simple typedef of type s64.
      
      The conversion was done with coccinelle and some manual mopping up.
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      2456e855
  22. 13 12月, 2016 1 次提交
  23. 12 11月, 2016 2 次提交
  24. 08 11月, 2016 1 次提交
    • T
      ALSA: info: Return error for invalid read/write · 6809cd68
      Takashi Iwai 提交于
      Currently the ALSA proc handler allows read or write even if the proc
      file were write-only or read-only.  It's mostly harmless, does thing
      but allocating memory and ignores the input/output.  But it doesn't
      tell user about the invalid use, and it's confusing and inconsistent
      in comparison with other proc files.
      
      This patch adds some sanity checks and let the proc handler returning
      an -EIO error when the invalid read/write is performed.
      
      Cc: <stable@vger.kernel.org> # v4.2+
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      6809cd68