01 Nov, 2011

1 commit


12 Jul, 2011

1 commit


14 Jun, 2011

1 commit


17 Oct, 2010

1 commit

  • When a driver module is unloaded and the last still open file is a raw
    MIDI device, the card and its devices will be actually freed in the
    snd_card_file_remove() call when that file is closed. Afterwards, rmidi
    and rmidi->card point into freed memory, so the module pointer is likely
    to be garbage.
    (This was introduced by commit 9a1b64caac82aa02cb74587ffc798e6f42c6170a.)

    Signed-off-by: Clemens Ladisch
    Reported-by: Krzysztof Foltman
    Cc: 2.6.30-2.6.35
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     

09 Sep, 2010

1 commit

  • If we pass in a device which is higher than SNDRV_RAWMIDI_DEVICES then
    the "next device" should be -1. This function just returns device + 1.

    But the main thing is that "device + 1" can lead to a (harmless) integer
    overflow and that annoys static analysis tools.

    [fix the case for device == SNDRV_RAWMIDI_DEVICE by tiwai]

    Signed-off-by: Dan Carpenter
    Signed-off-by: Takashi Iwai

    Dan Carpenter
     

13 Apr, 2010

1 commit

  • Set no_llseek to llseek file ops of each sound component (but for hwdep).
    This avoids the implicit BKL invocation via generic_file_llseek() used
    as default when fops.llseek is NULL.

    Also call nonseekable_open() at each open ops to ensure the file flags
    have no seek bit.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

10 Dec, 2009

1 commit

  • While Linux provided an O_SYNC flag basically since day 1, it took until
    Linux 2.4.0-test12pre2 to actually get it implemented for filesystems,
    since that day we had generic_osync_around with only minor changes and the
    great "For now, when the user asks for O_SYNC, we'll actually give
    O_DSYNC" comment. This patch intends to actually give us real O_SYNC
    semantics in addition to the O_DSYNC semantics. After Jan's O_SYNC
    patches which are required before this patch it's actually surprisingly
    simple, we just need to figure out when to set the datasync flag to
    vfs_fsync_range and when not.

    This patch renames the existing O_SYNC flag to O_DSYNC while keeping it's
    numerical value to keep binary compatibility, and adds a new real O_SYNC
    flag. To guarantee backwards compatiblity it is defined as expanding to
    both the O_DSYNC and the new additional binary flag (__O_SYNC) to make
    sure we are backwards-compatible when compiled against the new headers.

    This also means that all places that don't care about the differences can
    just check O_DSYNC and get the right behaviour for O_SYNC, too - only
    places that actuall care need to check __O_SYNC in addition. Drivers and
    network filesystems have been updated in a fail safe way to always do the
    full sync magic if O_DSYNC is set. The few places setting O_SYNC for
    lower layers are kept that way for now to stay failsafe.

    We enforce that O_DSYNC is set when __O_SYNC is set early in the open path
    to make sure we always get these sane options.

    Note that parisc really screwed up their headers as they already define a
    O_DSYNC that has always been a no-op. We try to repair it by using it for
    the new O_DSYNC and redefinining O_SYNC to send both the traditional
    O_SYNC numerical value _and_ the O_DSYNC one.

    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Grant Grundler
    Cc: "David S. Miller"
    Cc: Ingo Molnar
    Cc: "H. Peter Anvin"
    Cc: Thomas Gleixner
    Cc: Al Viro
    Cc: Andreas Dilger
    Acked-by: Trond Myklebust
    Acked-by: Kyle McMartin
    Acked-by: Ulrich Drepper
    Signed-off-by: Christoph Hellwig
    Signed-off-by: Andrew Morton
    Signed-off-by: Jan Kara

    Christoph Hellwig
     

10 Nov, 2009

6 commits

  • Record the pid of the task that opened a RawMIDI substream.

    Signed-off-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     
  • The substream_opened field is to count the number of opened substreams,
    not the number of times that any substreams have been opened.

    Furthermore, all substreams being opened does not imply that the next
    open would fail, due to the possibility of O_APPEND. With this wrong
    check, opening a substream multiple times would succeed only if the
    device had more unopened substreams.

    Signed-off-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     
  • Takashi Iwai
     
  • Commit 9a1b64caac82aa02cb74587ffc798e6f42c6170a in 2.6.30 broke the
    error handling code in rawmidi_open_priv().

    If only the output substream of a RawMIDI device has been opened and
    if this device is then opened with O_RDWR | O_APPEND and if the
    initialization of the input substream fails (either because of low
    memory or because the device driver's open callback fails), then the
    runtime structure of the already open output substream will be freed
    and all following writes through the first handle will cause
    snd_rawmidi_write() to use the NULL runtime pointer.

    Signed-off-by: Clemens Ladisch
    Cc:
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     
  • Commit 9a1b64caac82aa02cb74587ffc798e6f42c6170a in 2.6.30 dropped the
    check that a substream must already have been opened with O_APPEND to be
    able to open it a second time.

    This would make it possible for a substream to be switched to append
    mode, which would mean that non-atomic writes would fail unexpectedly.

    Signed-off-by: Clemens Ladisch
    Cc:
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     
  • Commit 9a1b64caac82aa02cb74587ffc798e6f42c6170a in 2.6.30 moved the
    substream initialization code to where it would be executed every time
    the substream is opened.

    This had the consequence that any further opening would drop and leak
    the data in the existing buffer, and that the device driver's open
    callback would be called multiple times, unexpectedly.

    Signed-off-by: Clemens Ladisch
    Cc:
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     

06 Nov, 2009

1 commit

  • Instead of storing the PID number, take a reference to the task's pid
    structure. This protects against duplicates due to PID overflows, and
    using pid_vnr() ensures that the PID returned by snd_ctl_elem_info() is
    correct as seen from the current namespace.

    Signed-off-by: Clemens Ladisch
    Signed-off-by: Takashi Iwai

    Clemens Ladisch
     

15 Jul, 2009

1 commit


09 Mar, 2009

2 commits


18 Dec, 2008

1 commit


03 Nov, 2008

1 commit


25 Sep, 2008

1 commit

  • The PCM and rawmidi open callbacks have a lock against card->controls_list
    but it takes a wrong one, card->controls_rwsem, instead of a right one
    card->ctl_files_rwlock. This patch fixes them.

    This change also fixes automatically the potential deadlocks due to
    mm->mmap_sem in munmap and copy_from/to_user, reported by Sitsofe
    Wheeler:

    A: snd_ctl_elem_user_tlv(): card->controls_rwsem => mm->mmap_sem
    B: snd_pcm_open(): card->open_mutex => card->controls_rwsem
    C: munmap: mm->mmap_sem => snd_pcm_release(): card->open_mutex

    The patch breaks the chain.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

13 Aug, 2008

1 commit


01 Feb, 2008

2 commits

  • snd_rawmidi_kernel_read1/write1 weren't annotated but used
    copy_to_user/copy_from_user when one of parameters (kernel) was equal to 0
    remove it and add properly annotated parameter

    Signed-off-by: Marcin Ślusarz
    Signed-off-by: Takashi Iwai
    Signed-off-by: Jaroslav Kysela

    Marcin Ślusarz
     
  • This header file exists only for some hacks to adapt alsa-driver
    tree. It's useless for building in the kernel. Let's move a few
    lines in it to sound/core.h and remove it.
    With this patch, sound/driver.h isn't removed but has just a single
    compile warning to include it. This should be really killed in
    future.

    Signed-off-by: Takashi Iwai
    Signed-off-by: Jaroslav Kysela

    Takashi Iwai
     

16 Oct, 2007

2 commits


09 May, 2007

1 commit


13 Feb, 2007

1 commit

  • Many struct file_operations in the kernel can be "const". Marking them const
    moves these to the .rodata section, which avoids false sharing with potential
    dirty data. In addition it'll catch accidental writes at compile time to
    these shared resources.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

09 Feb, 2007

1 commit

  • This patch converts most uses of list_for_each to list_for_each_entry all
    across alsa. In some place apparently an item can be on a list with
    different pointers so of course that isn't compatible with list_for_each, I
    therefore didn't touch those places.

    Signed-off-by: Johannes Berg
    Signed-off-by: Takashi Iwai
    Signed-off-by: Jaroslav Kysela

    Johannes Berg
     

20 Dec, 2006

1 commit

  • If snd_rawmidi_new() failed to allocate substreams for input
    (snd_rawmidi_alloc_substreams() failed to populate a
    &rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT]), it will try to
    free rawmidi instance by snd_rawmidi_free().
    But it will cause oops because snd_rawmidi_free() tries to free
    both of substreams list but list for output
    (&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT]) is not initialized yet.

    Signed-off-by: Akinobu Mita
    Signed-off-by: Takashi Iwai
    Signed-off-by: Jaroslav Kysela

    Akinobu Mita
     

23 Sep, 2006

3 commits

  • The PCM and rawmidi substreams can be selected explicitly by opening
    control handle and set via *_PREFER_SUBDEVICE ioctl. But, when
    multiple controls are opened, the driver gets confused.
    The patch fixes the initialization of prefer_*_subdevice and the
    check of multiple controls. The first set subdevice is picked up
    as the valid one.

    Signed-off-by: Takashi Iwai
    Signed-off-by: Jaroslav Kysela

    Takashi Iwai
     
  • Orignally proposed by Sam Revitch .
    Unregister device files at disconnection to avoid the futher accesses.
    Also, the dev_unregister callback is removed and replaced with the
    combination of disconnect + free.
    A new function snd_card_free_when_closed() is introduced, which is
    used in USB disconnect callback.

    Signed-off-by: Takashi Iwai
    Signed-off-by: Jaroslav Kysela

    Takashi Iwai
     
  • - Add the linked list to each proc entry to enable a single-shot
    disconnection (unregister)
    - Deprecate snd_info_unregister(), use snd_info_free_entry()
    - Removed NULL checks of snd_info_free_entry()

    Signed-off-by: Takashi Iwai
    Signed-off-by: Jaroslav Kysela

    Takashi Iwai
     

23 Jun, 2006

2 commits


29 Mar, 2006

1 commit


22 Mar, 2006

1 commit


03 Jan, 2006

4 commits