1. 31 3月, 2011 1 次提交
  2. 26 3月, 2011 1 次提交
  3. 25 3月, 2011 1 次提交
    • B
      ALSA: vmalloc buffers should use normal mmap · 3674f19d
      Benjamin Herrenschmidt 提交于
      It's a big no-no to use pgprot_noncached() when mmap'ing such buffers
      into userspace since they are mapped cachable in kernel space.
      
      This can cause all sort of interesting things ranging from to garbled
      sound to lockups on various architectures. I've observed that usb-audio
      is broken on powerpc 4xx for example because of that.
      
      Also remove the now unused snd_pcm_lib_mmap_noncached(). It's
      an arch business to know when to use uncached mappings, there's
      already hacks for MIPS inside snd_pcm_default_mmap() and other
      archs are supposed to use dma_mmap_coherent().
      
      (See my separate patch that adds dma_mmap_coherent() to powerpc)
      Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      CC: <stable@kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      3674f19d
  4. 17 3月, 2011 1 次提交
  5. 11 3月, 2011 1 次提交
  6. 08 3月, 2011 2 次提交
    • C
      ALSA: control: clean up snd_ctl_hole_check() · 0e82e5fa
      Clemens Ladisch 提交于
      The return value of snd_ctl_hole_check() is used only to detect whether
      to continue the loop in snd_ctl_find_hole() or not, so we can simplify
      the code by changing this return type to a boolean.  Also rename this
      function to better show what it actually does.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      0e82e5fa
    • C
      ALSA: control: fix numid conflict check for new controls · 7c733587
      Clemens Ladisch 提交于
      The purpose of the snd_ctl_hole_check() function is to find conflicts
      between the numerical IDs of the new control and those of any existing
      controls.  However, it would fail to detect an existing control whose
      count is smaller than the new control's count and whose interval of IDs
      is entirely contained in the interval of the new control's IDs.
      
      To fix this, use the correct formula to detect overlapping intervals,
      which happens to simplify the condition.
      
      This problem was not encountered so far because ALSA does not yet allow
      drivers to allocate specific control IDs.
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7c733587
  7. 27 2月, 2011 1 次提交
  8. 21 2月, 2011 1 次提交
  9. 15 2月, 2011 1 次提交
  10. 11 2月, 2011 2 次提交
  11. 10 1月, 2011 2 次提交
  12. 21 12月, 2010 1 次提交
  13. 30 11月, 2010 1 次提交
  14. 24 11月, 2010 1 次提交
    • K
      ALSA: support module on-demand loading for seq and timer · 03cfe6f5
      Kay Sievers 提交于
      If CONFIG_SND_DYNAMIC_MINORS is used, assign /dev/snd/seq and
      /dev/snd/timer the usual static minors, and export specific
      module aliases to generate udev module on-demand loading
      instructions:
      
        $ cat /lib/modules/2.6.33.4-smp/modules.devname
        # Device nodes to trigger on-demand module loading.
        microcode cpu/microcode c10:184
        fuse fuse c10:229
        ppp_generic ppp c108:0
        tun net/tun c10:200
        uinput uinput c10:223
        dm_mod mapper/control c10:236
        snd_timer snd/timer c116:33
        snd_seq snd/seq c116:1
      
      The last two lines instruct udev to create device nodes, even
      when the modules are not loaded at that time.
      
      As soon as userspace accesses any of these nodes, the in-kernel
      module-loader will load the module, and the device can be used.
      
      The header file minor calculation needed to be simplified to
      make __stringify() (supports only two indirections) in
      the MODULE_ALIAS macro work.
      
      This is part of systemd's effort to get rid of unconditional
      module load instructions and needless init scripts.
      
      Cc: Lennart Poettering <lennart@poettering.net>
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Signed-off-by: NClemens Ladisch <clemens@ladisch.de>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      03cfe6f5
  15. 22 11月, 2010 5 次提交
  16. 18 11月, 2010 1 次提交
  17. 02 11月, 2010 1 次提交
  18. 23 10月, 2010 1 次提交
    • K
      driver core: remove CONFIG_SYSFS_DEPRECATED_V2 but keep it for block devices · 39aba963
      Kay Sievers 提交于
      This patch removes the old CONFIG_SYSFS_DEPRECATED_V2 config option,
      but it keeps the logic around to handle block devices in the old manner
      as some people like to run new kernel versions on old (pre 2007/2008)
      distros.
      Signed-off-by: NKay Sievers <kay.sievers@vrfy.org>
      Cc: Jens Axboe <axboe@kernel.dk>
      Cc: Stephen Hemminger <shemminger@vyatta.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: "James E.J. Bottomley" <James.Bottomley@suse.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
      Cc: Randy Dunlap <randy.dunlap@oracle.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jaroslav Kysela <perex@perex.cz>
      Cc: Takashi Iwai <tiwai@suse.de>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: David Howells <dhowells@redhat.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      
      39aba963
  19. 17 10月, 2010 1 次提交
  20. 15 10月, 2010 1 次提交
    • A
      llseek: automatically add .llseek fop · 6038f373
      Arnd Bergmann 提交于
      All file_operations should get a .llseek operation so we can make
      nonseekable_open the default for future file operations without a
      .llseek pointer.
      
      The three cases that we can automatically detect are no_llseek, seq_lseek
      and default_llseek. For cases where we can we can automatically prove that
      the file offset is always ignored, we use noop_llseek, which maintains
      the current behavior of not returning an error from a seek.
      
      New drivers should normally not use noop_llseek but instead use no_llseek
      and call nonseekable_open at open time.  Existing drivers can be converted
      to do the same when the maintainer knows for certain that no user code
      relies on calling seek on the device file.
      
      The generated code is often incorrectly indented and right now contains
      comments that clarify for each added line why a specific variant was
      chosen. In the version that gets submitted upstream, the comments will
      be gone and I will manually fix the indentation, because there does not
      seem to be a way to do that using coccinelle.
      
      Some amount of new code is currently sitting in linux-next that should get
      the same modifications, which I will do at the end of the merge window.
      
      Many thanks to Julia Lawall for helping me learn to write a semantic
      patch that does all this.
      
      ===== begin semantic patch =====
      // This adds an llseek= method to all file operations,
      // as a preparation for making no_llseek the default.
      //
      // The rules are
      // - use no_llseek explicitly if we do nonseekable_open
      // - use seq_lseek for sequential files
      // - use default_llseek if we know we access f_pos
      // - use noop_llseek if we know we don't access f_pos,
      //   but we still want to allow users to call lseek
      //
      @ open1 exists @
      identifier nested_open;
      @@
      nested_open(...)
      {
      <+...
      nonseekable_open(...)
      ...+>
      }
      
      @ open exists@
      identifier open_f;
      identifier i, f;
      identifier open1.nested_open;
      @@
      int open_f(struct inode *i, struct file *f)
      {
      <+...
      (
      nonseekable_open(...)
      |
      nested_open(...)
      )
      ...+>
      }
      
      @ read disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      <+...
      (
         *off = E
      |
         *off += E
      |
         func(..., off, ...)
      |
         E = *off
      )
      ...+>
      }
      
      @ read_no_fpos disable optional_qualifier exists @
      identifier read_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t read_f(struct file *f, char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ write @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      expression E;
      identifier func;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      <+...
      (
        *off = E
      |
        *off += E
      |
        func(..., off, ...)
      |
        E = *off
      )
      ...+>
      }
      
      @ write_no_fpos @
      identifier write_f;
      identifier f, p, s, off;
      type ssize_t, size_t, loff_t;
      @@
      ssize_t write_f(struct file *f, const char *p, size_t s, loff_t *off)
      {
      ... when != off
      }
      
      @ fops0 @
      identifier fops;
      @@
      struct file_operations fops = {
       ...
      };
      
      @ has_llseek depends on fops0 @
      identifier fops0.fops;
      identifier llseek_f;
      @@
      struct file_operations fops = {
      ...
       .llseek = llseek_f,
      ...
      };
      
      @ has_read depends on fops0 @
      identifier fops0.fops;
      identifier read_f;
      @@
      struct file_operations fops = {
      ...
       .read = read_f,
      ...
      };
      
      @ has_write depends on fops0 @
      identifier fops0.fops;
      identifier write_f;
      @@
      struct file_operations fops = {
      ...
       .write = write_f,
      ...
      };
      
      @ has_open depends on fops0 @
      identifier fops0.fops;
      identifier open_f;
      @@
      struct file_operations fops = {
      ...
       .open = open_f,
      ...
      };
      
      // use no_llseek if we call nonseekable_open
      ////////////////////////////////////////////
      @ nonseekable1 depends on !has_llseek && has_open @
      identifier fops0.fops;
      identifier nso ~= "nonseekable_open";
      @@
      struct file_operations fops = {
      ...  .open = nso, ...
      +.llseek = no_llseek, /* nonseekable */
      };
      
      @ nonseekable2 depends on !has_llseek @
      identifier fops0.fops;
      identifier open.open_f;
      @@
      struct file_operations fops = {
      ...  .open = open_f, ...
      +.llseek = no_llseek, /* open uses nonseekable */
      };
      
      // use seq_lseek for sequential files
      /////////////////////////////////////
      @ seq depends on !has_llseek @
      identifier fops0.fops;
      identifier sr ~= "seq_read";
      @@
      struct file_operations fops = {
      ...  .read = sr, ...
      +.llseek = seq_lseek, /* we have seq_read */
      };
      
      // use default_llseek if there is a readdir
      ///////////////////////////////////////////
      @ fops1 depends on !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier readdir_e;
      @@
      // any other fop is used that changes pos
      struct file_operations fops = {
      ... .readdir = readdir_e, ...
      +.llseek = default_llseek, /* readdir is present */
      };
      
      // use default_llseek if at least one of read/write touches f_pos
      /////////////////////////////////////////////////////////////////
      @ fops2 depends on !fops1 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read.read_f;
      @@
      // read fops use offset
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = default_llseek, /* read accesses f_pos */
      };
      
      @ fops3 depends on !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ... .write = write_f, ...
      +	.llseek = default_llseek, /* write accesses f_pos */
      };
      
      // Use noop_llseek if neither read nor write accesses f_pos
      ///////////////////////////////////////////////////////////
      
      @ fops4 depends on !fops1 && !fops2 && !fops3 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      identifier write_no_fpos.write_f;
      @@
      // write fops use offset
      struct file_operations fops = {
      ...
       .write = write_f,
       .read = read_f,
      ...
      +.llseek = noop_llseek, /* read and write both use no f_pos */
      };
      
      @ depends on has_write && !has_read && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier write_no_fpos.write_f;
      @@
      struct file_operations fops = {
      ... .write = write_f, ...
      +.llseek = noop_llseek, /* write uses no f_pos */
      };
      
      @ depends on has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      identifier read_no_fpos.read_f;
      @@
      struct file_operations fops = {
      ... .read = read_f, ...
      +.llseek = noop_llseek, /* read uses no f_pos */
      };
      
      @ depends on !has_read && !has_write && !fops1 && !fops2 && !has_llseek && !nonseekable1 && !nonseekable2 && !seq @
      identifier fops0.fops;
      @@
      struct file_operations fops = {
      ...
      +.llseek = noop_llseek, /* no read or write fn */
      };
      ===== End semantic patch =====
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: Christoph Hellwig <hch@infradead.org>
      6038f373
  21. 11 10月, 2010 1 次提交
  22. 29 9月, 2010 1 次提交
    • D
      ALSA: prevent heap corruption in snd_ctl_new() · 5591bf07
      Dan Rosenberg 提交于
      The snd_ctl_new() function in sound/core/control.c allocates space for a
      snd_kcontrol struct by performing arithmetic operations on a
      user-provided size without checking for integer overflow.  If a user
      provides a large enough size, an overflow will occur, the allocated
      chunk will be too small, and a second user-influenced value will be
      written repeatedly past the bounds of this chunk.  This code is
      reachable by unprivileged users who have permission to open
      a /dev/snd/controlC* device (on many distros, this is group "audio") via
      the SNDRV_CTL_IOCTL_ELEM_ADD and SNDRV_CTL_IOCTL_ELEM_REPLACE ioctls.
      Signed-off-by: NDan Rosenberg <drosenberg@vsecurity.com>
      Cc: <stable@kernel.org>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      5591bf07
  23. 17 9月, 2010 2 次提交
  24. 16 9月, 2010 1 次提交
  25. 14 9月, 2010 1 次提交
  26. 09 9月, 2010 1 次提交
  27. 08 9月, 2010 1 次提交
  28. 07 9月, 2010 1 次提交
  29. 28 8月, 2010 1 次提交
    • D
      ALSA: pcm: add more format names · 7a28826a
      Dan Carpenter 提交于
      There were some new formats added in commit 15c0cee6 "ALSA: pcm:
      Define G723 3-bit and 5-bit formats".  That commit increased
      SNDRV_PCM_FORMAT_LAST as well.  My concern is that there are a couple
      places which do:
      
              for (i = 0; i < SNDRV_PCM_FORMAT_LAST; i++) {
                      if (dummy->pcm_hw.formats & (1ULL << i))
                              snd_iprintf(buffer, " %s", snd_pcm_format_name(i));
              }
      
      I haven't tested these but it looks like if "i" were equal to
      SNDRV_PCM_FORMAT_G723_24 or higher then we might read past the end of
      the array.
      Signed-off-by: NDan Carpenter <error27@gmail.com>
      Signed-off-by: NTakashi Iwai <tiwai@suse.de>
      7a28826a
  30. 19 8月, 2010 1 次提交
  31. 18 8月, 2010 2 次提交