26 Feb, 2016

1 commit

  • Currently the interrupt handler of HD-audio driver assumes that no irq
    update is needed while processing the irq. But in reality, it has
    been confirmed that the HW irq is issued even during the irq
    handling. Since we clear the irq status at the beginning, process the
    interrupt, then exits from the handler, the lately issued interrupt is
    left untouched without being properly processed.

    This patch changes the interrupt handler code to loop over the
    check-and-process. The handler tries repeatedly as long as the IRQ
    status are turned on, and either stream or CORB/RIRB is handled.

    For checking the stream handling, snd_hdac_bus_handle_stream_irq()
    returns a value indicating the stream indices bits. Other than that,
    the change is only in the irq handler itself.

    Reported-by: Libin Yang
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

25 Feb, 2016

3 commits

  • HP EliteBook 755 G2 with ALC3228 (ALC280) codec [103c:221c] requires
    the known fixup (ALC269_FIXUP_HEADSET_MIC) for making the headset mic
    working. Also, it suffers from the loopback noise problem, so we
    should disable aamix path as well.

    Reported-by: Derick Eddington
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • On one of the machines we enable, we found that the actual speaker volume
    did not always correspond to the volume set in alsamixer. This patch
    fixes that problem.

    This patch was orginally written by Kailang @ Realtek, I've rebased it
    to fit sound git master.

    Cc: stable@vger.kernel.org
    BugLink: https://bugs.launchpad.net/bugs/1549660
    Co-Authored-By: Kailang
    Signed-off-by: David Henningsson
    Signed-off-by: Takashi Iwai

    David Henningsson
     
  • After login to the desktop on Dell Inspiron 3162,
    there's a very loud background noise comes from the builtin speaker.
    The noise does not go away even if the speaker is muted.

    The noise disappears after using the aamix fixup.

    Codec: Realtek ALC3234
    Address: 0
    AFG Function Id: 0x1 (unsol 1)
    Vendor Id: 0x10ec0255
    Subsystem Id: 0x10280725
    Revision Id: 0x100002
    No Modem Function Group found

    BugLink: http://bugs.launchpad.net/bugs/1549620
    Signed-off-by: Kai-Heng Feng
    Cc:
    Signed-off-by: Takashi Iwai

    Kai-Heng Feng
     

23 Feb, 2016

1 commit

  • Some Skylake machines show the codec probe errors in certain
    situations, e.g. HP Z240 desktop fails to probe the onboard Realtek
    codec at reloading the snd-hda-intel module like:
    snd_hda_intel 0000:00:1f.3: spurious response 0x200:0x2, last cmd=0x000000
    snd_hda_intel 0000:00:1f.3: azx_get_response timeout, switching to polling mode: lastcmd=0x000f0000
    snd_hda_intel 0000:00:1f.3: No response from codec, disabling MSI: last cmd=0x000f0000
    snd_hda_intel 0000:00:1f.3: Codec #0 probe error; disabling it...
    hdaudio hdaudioC0D2: no AFG or MFG node found
    snd_hda_intel 0000:00:1f.3: no codecs initialized

    Also, HP G470 G3 suffers from the similar problem, as reported in
    bugzilla below. On this machine, the codec probe error appears even
    at a fresh boot.

    As Libin suggested, the same workaround used for Broxton in the commit
    [6639484ddaf6: ALSA: hda - disable dynamic clock gating on Broxton
    before reset] can be applied for Skylake in order to fix this problem.
    The Intel HW team also confirmed that this is needed for SKL.

    This patch makes the workaround applied to both SKL and BXT
    platforms. The referred macros are moved and one superfluous macro
    (IS_BROXTON()) is another one (IS_BXT()) as well.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=112731
    Suggested-by: Libin Yang
    Cc: # v4.4+
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

18 Feb, 2016

1 commit

  • A non-atomic PCM stream may take snd_pcm_link_rwsem rw semaphore twice
    in the same code path, e.g. one in snd_pcm_action_nonatomic() and
    another in snd_pcm_stream_lock(). Usually this is OK, but when a
    write lock is issued between these two read locks, the problem
    happens: the write lock is blocked due to the first reade lock, and
    the second read lock is also blocked by the write lock. This
    eventually deadlocks.

    The reason is the way rwsem manages waiters; it's queued like FIFO, so
    even if the writer itself doesn't take the lock yet, it blocks all the
    waiters (including reads) queued after it.

    As a workaround, in this patch, we replace the standard down_write()
    with an spinning loop. This is far from optimal, but it's good
    enough, as the spinning time is supposed to be relatively short for
    normal PCM operations, and the code paths requiring the write lock
    aren't called so often.

    Reported-by: Vinod Koul
    Tested-by: Ramesh Babu
    Cc: # v3.18+
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

16 Feb, 2016

1 commit

  • The commit [7f0973e973cd: ALSA: seq: Fix lockdep warnings due to
    double mutex locks] split the management of two linked lists (source
    and destination) into two individual calls for avoiding the AB/BA
    deadlock. However, this may leave the possible double deletion of one
    of two lists when the counterpart is being deleted concurrently.
    It ends up with a list corruption, as revealed by syzkaller fuzzer.

    This patch fixes it by checking the list emptiness and skipping the
    deletion and the following process.

    BugLink: http://lkml.kernel.org/r/CACT4Y+bay9qsrz6dQu31EcGaH9XwfW7o3oBzSQUG9fMszoh=Sg@mail.gmail.com
    Fixes: 7f0973e973cd ('ALSA: seq: Fix lockdep warnings due to 'double mutex locks)
    Reported-by: Dmitry Vyukov
    Tested-by: Dmitry Vyukov
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

15 Feb, 2016

2 commits

  • The commit [991f86d7ae4e: ALSA: hda - Flush the pending probe work at
    remove] introduced the sync of async probe work at remove for fixing
    the race. However, this may lead to another hangup when the module
    removal is performed quickly before starting the probe work, because
    it issues flush_work() and it's blocked forever.

    The workaround is to use cancel_work_sync() instead of flush_work()
    there.

    Fixes: 991f86d7ae4e ('ALSA: hda - Flush the pending probe work at remove')
    Cc: # v3.17+
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • When multiple concurrent writes happen on the ALSA sequencer device
    right after the open, it may try to allocate vmalloc buffer for each
    write and leak some of them. It's because the presence check and the
    assignment of the buffer is done outside the spinlock for the pool.

    The fix is to move the check and the assignment into the spinlock.

    (The current implementation is suboptimal, as there can be multiple
    unnecessary vmallocs because the allocation is done before the check
    in the spinlock. But the pool size is already checked beforehand, so
    this isn't a big problem; that is, the only possible path is the
    multiple writes before any pool assignment, and practically seen, the
    current coverage should be "good enough".)

    The issue was triggered by syzkaller fuzzer.

    BugLink: http://lkml.kernel.org/r/CACT4Y+bSzazpXNvtAr=WXaL8hptqjHwqEyFA+VN2AWEx=aurkg@mail.gmail.com
    Reported-by: Dmitry Vyukov
    Tested-by: Dmitry Vyukov
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

13 Feb, 2016

1 commit

  • The 'umidi' object will be free'd on the error path by snd_usbmidi_free()
    when tearing down the rawmidi interface. So we shouldn't try to free it
    in snd_usbmidi_create() after having registered the rawmidi interface.

    Found by KASAN.

    Signed-off-by: Andrey Konovalov
    Acked-by: Clemens Ladisch
    Cc:
    Signed-off-by: Takashi Iwai

    Andrey Konovalov
     

12 Feb, 2016

1 commit


11 Feb, 2016

9 commits


10 Feb, 2016

1 commit


09 Feb, 2016

5 commits

  • snd_timer_user_read() has a potential race among parallel reads, as
    qhead and qused are updated outside the critical section due to
    copy_to_user() calls. Move them into the critical section, and also
    sanitize the relevant code a bit.

    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • sound/firewire/digi00x/amdtp-dot.c:67: warning: type qualifiers ignored on function return type

    Drop the bogus "const" type qualifier on the return type of dot_scrt()
    to fix this.

    Signed-off-by: Geert Uytterhoeven
    Reviewed-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Geert Uytterhoeven
     
  • The hda_jack_tbl entries are managed by snd_array for allowing
    multiple jacks. It's good per se, but the problem is that struct
    hda_jack_callback keeps the hda_jack_tbl pointer. Since snd_array
    doesn't preserve each pointer at resizing the array, we can't keep the
    original pointer but have to deduce the pointer at each time via
    snd_array_entry() instead. Actually, this resulted in the deference
    to the wrong pointer on codecs that have many pins such as CS4208.

    This patch replaces the pointer to the NID value as the search key.
    As an unexpected good side effect, this even simplifies the code, as
    only NID is needed in most cases.

    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • A slave timer element also unlinks at snd_timer_stop() but it takes
    only slave_active_lock. When a slave is assigned to a master,
    however, this may become a race against the master's interrupt
    handling, eventually resulting in a list corruption. The actual bug
    could be seen with a syzkaller fuzzer test case in BugLink below.

    As a fix, we need to take timeri->timer->lock when timer isn't NULL,
    i.e. assigned to a master, while the assignment to a master itself is
    protected by slave_active_lock.

    BugLink: http://lkml.kernel.org/r/CACT4Y+Y_Bm+7epAb=8Wi=AaWd+DYS7qawX52qxdCfOfY49vozQ@mail.gmail.com
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • In snd_timer_notify1(), the wrong timer instance was passed for slave
    ccallback function. This leads to the access to the wrong data when
    an incompatible master is handled (e.g. the master is the sequencer
    timer and the slave is a user timer), as spotted by syzkaller fuzzer.

    This patch fixes that wrong assignment.

    BugLink: http://lkml.kernel.org/r/CACT4Y+Y_Bm+7epAb=8Wi=AaWd+DYS7qawX52qxdCfOfY49vozQ@mail.gmail.com
    Reported-by: Dmitry Vyukov
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

08 Feb, 2016

5 commits

  • The match module lacked module license and description, so add it

    Acked-by: Pierre-Louis Bossart
    Signed-off-by: Vinod Koul
    Signed-off-by: Mark Brown

    Vinod Koul
     
  • DPCM driver is recommended for BYT, CHT based platforms, so if
    CONFIG_SND_SST_IPC_ACPI is selected then don't compile the BYT
    Device IDs in common ACPI driver to avoid probe conflicts.

    Signed-off-by: Pierre-Louis Bossart
    Acked-by: Jie Yang
    Signed-off-by: Vinod Koul
    Signed-off-by: Mark Brown

    Pierre-Louis Bossart
     
  • The ACPI match module is common to all three drivers, HSW, SKL
    and Atom-DPCM driver. But Atom-DPCM driver does not use common
    sst code so we cannot include the common SST module in Atom-DPCM
    driver.

    So the solution is to have a independent sst-match-acpi module
    which helps in matching for all the three drivers. Now all driver
    can be inbuilt in a single image

    This patch really fixes the regression introduced by the
    commit 95f098014815 ("ASoC: Intel: Move apci find machine routines")

    Acked-by: Jie Yang
    Acked-by: Pierre-Louis Bossart
    Signed-off-by: Vinod Koul
    Signed-off-by: Mark Brown

    Vinod Koul
     
  • This reverts commit dc901a354171 ("ASoC: Intel: fix ACPI probe
    regression with Atom DPCM driver") as the fix prevented the probe
    on HSW/BDW if Atom-DPCM was selected

    Acked-by: Jie Yang
    Acked-by: Pierre-Louis Bossart
    Signed-off-by: Vinod Koul
    Signed-off-by: Mark Brown

    Vinod Koul
     
  • Currently the selected timer backend is referred at any moment from
    the running PCM callbacks. When the backend is switched, it's
    possible to lead to inconsistency from the running backend. This was
    pointed by syzkaller fuzzer, and the commit [7ee96216c31a: ALSA:
    dummy: Disable switching timer backend via sysfs] disabled the dynamic
    switching for avoiding the crash.

    This patch improves the handling of timer backend switching. It keeps
    the reference to the selected backend during the whole operation of an
    opened stream so that it won't be changed by other streams.

    Together with this change, the hrtimer parameter is reenabled as
    writable now.

    NOTE: this patch also turned out to fix the still remaining race.
    Namely, ops was still replaced dynamically at dummy_pcm_open:

    static int dummy_pcm_open(struct snd_pcm_substream *substream)
    {
    ....
    dummy->timer_ops = &dummy_systimer_ops;
    if (hrtimer)
    dummy->timer_ops = &dummy_hrtimer_ops;

    Since dummy->timer_ops is common among all streams, and when the
    replacement happens during accesses of other streams, it may lead to a
    crash. This was actually triggered by syzkaller fuzzer and KASAN.

    This patch rewrites the code not to use the ops shared by all streams
    any longer, too.

    BugLink: http://lkml.kernel.org/r/CACT4Y+aZ+xisrpuM6cOXbL21DuM0yVxPYXf4cD4Md9uw0C3dBQ@mail.gmail.com
    Reported-by: Dmitry Vyukov
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

07 Feb, 2016

1 commit


06 Feb, 2016

1 commit

  • This reverts commit 0c25ad80408e95e0a4fbaf0056950206e95f726f.

    The original commit disabled the aamixer path due to the noise
    problem, but it turned out that some mobo with the same PCI SSID
    doesn't suffer from the issue, and the disabled function (analog
    loopback) is still demanded by users.

    Since the recent commit [e7fdd52779a6: ALSA: hda - Implement loopback
    control switch for Realtek and other codecs], we have the dynamic
    mixer switch to enable/disable the aamix path, and we don't have to
    disable the path statically any longer. So, let's revert the
    disablement, so that only the user suffering from the noise problem
    can turn off the aamix on the fly.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=108301
    Reported-by:
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

05 Feb, 2016

6 commits

  • Commit 3beab0f844fa added a member for control and status message, while
    it's planned and not implemented yet.

    This commit removes it.

    Fixes: 3beab0f844fa('ALSA: firewire-tascam: add support for outgoing MIDI messages by asynchronous transaction')
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • Currently, 'struct snd_tscm_spec' has a member named as 'is_controller' to
    identify MIDI controller. This member was originally added to skip
    parse control and status messages in isochronous packets for non-controller
    model.

    As long as I investigate, FW-1804 (non-controller) also transfers the
    control and status message, thus it becomes meaningless.

    This commit removes it.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • This model supports:
    * maximum 12 PCM channels for PCM playback
    * maximum 18 PCM channels for PCM capture
    * 4 ports for MIDI playback
    * 4 ports for MIDI capture
    * control and status messages in tx isochronous packets
    * up to 96.0 kHz

    This commit adds support for the model. As the other supported models,
    all of available PCM channels are always enabled.

    As I described in commit c0949b278515da94, Ilya Zimnovich had investigated
    TASCAM FireWire series in 2011 with his FW-1804. In his report, this model
    has internal multiplexer and any software implementation can control it.
    Following to the design of ALSA firewire stack, this commit won't
    implement it. It should be in userspace via Linux fw character device.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • When unsupported models are connected, snd-firewire-tascam module causes
    NULL pointer dereference in fw_core_remove_address_handler() (due to
    list_del_rcu()).

    This commit prevents this bug.

    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     
  • The static checker warning is:

    sound/pci/hda/patch_hdmi.c:460 hdmi_eld_ctl_get()
    error: __memcpy() 'eld->eld_buffer' too small (256 vs 512)

    I have a hard time figuring out if this can ever cause an information leak
    (I don't think so), but nonetheless it does not hurt to increase the
    robustness of the code.

    Fixes: 68e03de98507 ('ALSA: hda - hdmi: Do not expose eld data when eld is invalid')
    Reported-by: Dan Carpenter
    Signed-off-by: David Henningsson
    Cc: # v3.9+
    Signed-off-by: Takashi Iwai

    David Henningsson
     
  • In ALSA timer core, the active timer instance is managed in
    active_list linked list. Each element is added / removed dynamically
    at timer start, stop and in timer interrupt. The problem is that
    snd_timer_interrupt() has a thinko and leaves the element in
    active_list when it's the last opened element. This eventually leads
    to list corruption or use-after-free error.

    This hasn't been revealed because we used to delete the list forcibly
    in snd_timer_stop() in the past. However, the recent fix avoids the
    double-stop behavior (in commit [f784beb75ce8: ALSA: timer: Fix link
    corruption due to double start or stop]), and this leak hits reality.

    This patch fixes the link management in snd_timer_interrupt(). Now it
    simply unlinks no matter which stream is.

    BugLink: http://lkml.kernel.org/r/CACT4Y+Yy2aukHP-EDp8-ziNqNNmb-NTf=jDWXMP7jB8HDa2vng@mail.gmail.com
    Reported-by: Dmitry Vyukov
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

04 Feb, 2016

1 commit