06 Sep, 2019

1 commit

  • Pull sound fixes from Takashi Iwai:
    "A collection of small HD-audio fixes:

    - A regression fix for Realtek codecs due to the recent
    initialization procedure change

    - A fix for potential endless loop at the quirk table lookup

    - Quirks for Lenovo, ASUS and HP machines"

    * tag 'sound-5.3-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ALSA: hda/realtek - Fix the problem of two front mics on a ThinkCentre
    ALSA: hda/realtek - Enable internal speaker & headset mic of ASUS UX431FL
    ALSA: hda/realtek - Add quirk for HP Pavilion 15
    ALSA: hda/realtek - Fix overridden device-specific initialization
    ALSA: hda - Fix potential endless loop at applying quirks

    Linus Torvalds
     

04 Sep, 2019

1 commit

  • This ThinkCentre machine has a new realtek codec alc222, it is not
    in the support list, we add it in the realtek.c then this machine
    can apply FIXUPs for the realtek codec.

    And this machine has two front mics which can't be handled
    by PA so far, it uses the pin 0x18 and 0x19 as the front mics, as
    a result the existing FIXUP ALC294_FIXUP_LENOVO_MIC_LOCATION doesn't
    work on this machine. Fortunately another FIXUP
    ALC283_FIXUP_HEADSET_MIC also can change the location for one of the
    two mics on this machine.

    Link: https://lore.kernel.org/r/20190904055327.9883-1-hui.wang@canonical.com
    Signed-off-by: Hui Wang
    Cc:
    Signed-off-by: Takashi Iwai

    Hui Wang
     

03 Sep, 2019

1 commit

  • Original pin node values of ASUS UX431FL with ALC294:

    0x12 0xb7a60140
    0x13 0x40000000
    0x14 0x90170110
    0x15 0x411111f0
    0x16 0x411111f0
    0x17 0x90170111
    0x18 0x411111f0
    0x19 0x411111f0
    0x1a 0x411111f0
    0x1b 0x411111f0
    0x1d 0x4066852d
    0x1e 0x411111f0
    0x1f 0x411111f0
    0x21 0x04211020

    1. Has duplicated internal speakers (0x14 & 0x17) which makes the output
    route become confused. So, the output volume cannot be changed by
    setting.
    2. Misses the headset mic pin node.

    This patch disables the confusing speaker (NID 0x14) and enables the
    headset mic (NID 0x19).

    Link: https://lore.kernel.org/r/20190902100054.6941-1-jian-hong@endlessm.com
    Signed-off-by: Jian-Hong Pan
    Cc:
    Signed-off-by: Takashi Iwai

    Jian-Hong Pan
     

02 Sep, 2019

1 commit


30 Aug, 2019

1 commit

  • The recent change to shuffle the codec initialization procedure for
    Realtek via commit 607ca3bd220f ("ALSA: hda/realtek - EAPD turn on
    later") caused the silent output on some machines. This change was
    supposed to be safe, but it isn't actually; some devices have quirk
    setups to override the EAPD via COEF or BTL in the additional verb
    table, which is applied at the beginning of snd_hda_gen_init(). And
    this EAPD setup is again overridden in alc_auto_init_amp().

    For recovering from the regression, tell snd_hda_gen_init() not to
    apply the verbs there by a new flag, then apply the verbs in
    alc_init().

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204727
    Fixes: 607ca3bd220f ("ALSA: hda/realtek - EAPD turn on later")
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

29 Aug, 2019

1 commit

  • Since the chained quirks via chained_before flag is applied before the
    depth check, it may lead to the endless recursive calls, when the
    chain were set up incorrectly. Fix it by moving the depth check at
    the beginning of the loop.

    Fixes: 1f57825077dc ("ALSA: hda - Add chained_before flag to the fixup entry")
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

28 Aug, 2019

1 commit

  • Pull sound fixes from Takashi Iwai:
    "A collection of small fixes as usual:

    - More coverage of USB-audio descriptor sanity checks

    - A fix for mute LED regression on Conexant HD-audio codecs

    - A few device-specific fixes and quirks for USB-audio and HD-audio

    - A fix for (die-hard remaining) possible race in sequencer core

    - FireWire oxfw regression fix that was introduced in 5.3-rc1"

    * tag 'sound-5.3-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ALSA: oxfw: fix to handle correct stream for PCM playback
    ALSA: seq: Fix potential concurrent access to the deleted pool
    ALSA: usb-audio: Check mixer unit bitmap yet more strictly
    ALSA: line6: Fix memory leak at line6_init_pcm() error path
    ALSA: usb-audio: Fix invalid NULL check in snd_emuusb_set_samplerate()
    ALSA: hda/ca0132 - Add new SBZ quirk
    ALSA: usb-audio: Add implicit fb quirk for Behringer UFX1604
    ALSA: hda - Fixes inverted Conexant GPIO mic mute led

    Linus Torvalds
     

26 Aug, 2019

1 commit

  • When userspace application calls ioctl(2) to configure hardware for PCM
    playback substream, ALSA OXFW driver handles incoming AMDTP stream.
    In this case, outgoing AMDTP stream should be handled.

    This commit fixes the bug for v5.3-rc kernel.

    Fixes: 4f380d007052 ("ALSA: oxfw: configure packet format in pcm.hw_params callback")
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

25 Aug, 2019

1 commit

  • The input pool of a client might be deleted via the resize ioctl, the
    the access to it should be covered by the proper locks. Currently the
    only missing place is the call in snd_seq_ioctl_get_client_pool(), and
    this patch papers over it.

    Reported-by: syzbot+4a75454b9ca2777f35c7@syzkaller.appspotmail.com
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

22 Aug, 2019

2 commits

  • The bmControls (for UAC1) or bmMixerControls (for UAC2/3) bitmap has a
    variable size depending on both input and output pins. Its size is to
    fit with input * output bits. The problem is that the input size
    can't be determined simply from the unit descriptor itself but it
    needs to parse the whole connected sources. Although the
    uac_mixer_unit_get_channels() tries to check some possible overflow of
    this bitmap, it's incomplete due to the lack of the evaluation of
    input pins.

    For covering possible overflows, this patch adds the bitmap overflow
    check in the loop of input pins in parse_audio_mixer_unit().

    Fixes: 0bfe5e434e66 ("ALSA: usb-audio: Check mixer unit descriptors more strictly")
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • I forgot to release the allocated object at the early error path in
    line6_init_pcm(). For addressing it, slightly shuffle the code so
    that the PCM destructor (pcm->private_free) is assigned properly
    before all error paths.

    Fixes: 3450121997ce ("ALSA: line6: Fix write on zero-sized buffer")
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

21 Aug, 2019

1 commit

  • The quirk function snd_emuusb_set_samplerate() has a NULL check for
    the mixer element, but this is useless in the current code. It used
    to be a check against mixer->id_elems[unitid] but it was changed later
    to the value after mixer_eleme_list_to_info() which is always non-NULL
    due to the container_of() usage.

    This patch fixes the check before the conversion.

    While we're at it, correct a typo in the comment in the function,
    too.

    Fixes: 8c558076c740 ("ALSA: usb-audio: Clean up mixer element list traverse")
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

20 Aug, 2019

3 commits

  • This patch adds a new PCI subsys ID for the SBZ, as found and tested by
    me and some reddit users.

    Link: https://lore.kernel.org/lkml/20190819204008.14426-1-p.rekowski@gmail.com
    Signed-off-by: Paweł Rekowski
    Cc:
    Signed-off-by: Takashi Iwai

    Paweł Rekowski
     
  • Behringer UFX1604 requires the similar quirk to apply implicit fb like
    another Behringer model UFX1204 in order to fix the noisy playback.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=204631
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • "enabled" parameter historically referred to the device input or
    output, not to the led indicator. After the changes added with the led
    helper functions the mic mute led logic refers to the led and not to
    the mic input which caused led indicator to be negated.
    Fixing logic in cxt_update_gpio_led and updated
    cxt_fixup_gpio_mute_hook
    Also updated debug messages to ease further debugging if necessary.

    Fixes: 184e302b46c9 ("ALSA: hda/conexant - Use the mic-mute LED helper")
    Suggested-by: Takashi Iwai
    Signed-off-by: Jeronimo Borque
    Cc:
    Signed-off-by: Takashi Iwai

    Jeronimo Borque
     

16 Aug, 2019

2 commits

  • Pull sound fixes from Takashi Iwai:
    "All small fixes targeted for stable:

    - Two fixes for USB-audio with malformed descriptor, spotted by
    fuzzers

    - Two fixes Conexant HD-audio codec wrt power management

    - Quirks for HD-audio AMD platform and HP laptop

    - HD-audio memory leak fix"

    * tag 'sound-5.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ALSA: usb-audio: Fix a stack buffer overflow bug in check_input_term
    ALSA: usb-audio: Fix an OOB bug in parse_audio_mixer_unit
    ALSA: hda - Add a generic reboot_notify
    ALSA: hda - Let all conexant codec enter D3 when rebooting
    ALSA: hda/realtek - Add quirk for HP Envy x360
    ALSA: hda - Fix a memory leak bug
    ALSA: hda - Apply workaround for another AMD chip 1022:1487

    Linus Torvalds
     
  • `check_input_term` recursively calls itself with input from
    device side (e.g., uac_input_terminal_descriptor.bCSourceID)
    as argument (id). In `check_input_term`, if `check_input_term`
    is called with the same `id` argument as the caller, it triggers
    endless recursive call, resulting kernel space stack overflow.

    This patch fixes the bug by adding a bitmap to `struct mixer_build`
    to keep track of the checked ids and stop the execution if some id
    has been checked (similar to how parse_audio_unit handles unitid
    argument).

    Reported-by: Hui Peng
    Reported-by: Mathias Payer
    Signed-off-by: Hui Peng
    Cc:
    Signed-off-by: Takashi Iwai

    Hui Peng
     

15 Aug, 2019

1 commit

  • The `uac_mixer_unit_descriptor` shown as below is read from the
    device side. In `parse_audio_mixer_unit`, `baSourceID` field is
    accessed from index 0 to `bNrInPins` - 1, the current implementation
    assumes that descriptor is always valid (the length of descriptor
    is no shorter than 5 + `bNrInPins`). If a descriptor read from
    the device side is invalid, it may trigger out-of-bound memory
    access.

    ```
    struct uac_mixer_unit_descriptor {
    __u8 bLength;
    __u8 bDescriptorType;
    __u8 bDescriptorSubtype;
    __u8 bUnitID;
    __u8 bNrInPins;
    __u8 baSourceID[];
    }
    ```

    This patch fixes the bug by add a sanity check on the length of
    the descriptor.

    Reported-by: Hui Peng
    Reported-by: Mathias Payer
    Cc:
    Signed-off-by: Hui Peng
    Signed-off-by: Takashi Iwai

    Hui Peng
     

14 Aug, 2019

2 commits

  • Make codec enter D3 before rebooting or poweroff can fix the noise
    issue on some laptops. And in theory it is harmless for all codecs
    to enter D3 before rebooting or poweroff, let us add a generic
    reboot_notify, then realtek and conexant drivers can call this
    function.

    Cc: stable@vger.kernel.org
    Signed-off-by: Hui Wang
    Signed-off-by: Takashi Iwai

    Hui Wang
     
  • We have 3 new lenovo laptops which have conexant codec 0x14f11f86,
    these 3 laptops also have the noise issue when rebooting, after
    letting the codec enter D3 before rebooting or poweroff, the noise
    disappers.

    Instead of adding a new ID again in the reboot_notify(), let us make
    this function apply to all conexant codec. In theory make codec enter
    D3 before rebooting or poweroff is harmless, and I tested this change
    on a couple of other Lenovo laptops which have different conexant
    codecs, there is no side effect so far.

    Cc: stable@vger.kernel.org
    Signed-off-by: Hui Wang
    Signed-off-by: Takashi Iwai

    Hui Wang
     

13 Aug, 2019

1 commit


10 Aug, 2019

2 commits

  • In snd_hda_parse_generic_codec(), 'spec' is allocated through kzalloc().
    Then, the pin widgets in 'codec' are parsed. However, if the parsing
    process fails, 'spec' is not deallocated, leading to a memory leak.

    To fix the above issue, free 'spec' before returning the error.

    Fixes: 352f7f914ebb ("ALSA: hda - Merge Realtek parser code to generic parser")
    Signed-off-by: Wenwen Wang
    Cc:
    Signed-off-by: Takashi Iwai

    Wenwen Wang
     
  • Pull sound fixes from Takashi Iwai:
    "Lots of small fixes at this time since we've received the ASoC fix
    batch now.

    - Some coverage in ASoC core mostly for minor issues like NULL checks
    for DPCM and proper error handling in DAI instantiation

    - A collection of small device-specific changes in various ASoC codec
    and platform drivers

    - OF-tree refcount fixes in a few ASoC drivers

    - Fixes of memory leaks in the error paths of various ASoC / ALSA
    drivers

    - A workaround for a long-standing issue on AMD HD-audio device

    - Updates of MAINTAINERS, mail addresses, file permission fixups"

    * tag 'sound-5.3-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (38 commits)
    ALSA: firewire: fix a memory leak bug
    sound: fix a memory leak bug
    ALSA: hda - Workaround for crackled sound on AMD controller (1022:1457)
    ALSA: hiface: fix multiple memory leak bugs
    ALSA: hda - Don't override global PCM hw info flag
    ALSA: usb-audio: fix a memory leak bug
    ASoC: max98373: Remove executable bits
    ASoC: amd: acp3x: use dma address for acp3x dma driver
    ASoC: amd: acp3x: use dma_ops of parent device for acp3x dma driver
    ASoC: max98373: add 88200 and 96000 sampling rate support
    ASoC: sun4i-i2s: Incorrect SR and WSS computation
    MAINTAINERS: Update Intel ASoC drivers maintainers
    ASoC: ti: davinci-mcasp: Correct slot_width posed constraint
    ASoC: rockchip: Fix mono capture
    ASoC: Intel: Fix some acpi vs apci typo in somme comments
    ASoC: ti: davinci-mcasp: Fix clk PDIR handling for i2s master mode
    ASoC: Fail card instantiation if DAI format setup fails
    ASoC: SOF: Intel: hda: remove misleading error trace from IRQ thread
    ASoC: qcom: apq8016_sbc: Fix oops with multiple DAI links
    ASoC: dapm: fix a memory leak bug
    ...

    Linus Torvalds
     

09 Aug, 2019

1 commit


08 Aug, 2019

2 commits

  • In iso_packets_buffer_init(), 'b->packets' is allocated through
    kmalloc_array(). Then, the aligned packet size is checked. If it is
    larger than PAGE_SIZE, -EINVAL will be returned to indicate the error.
    However, the allocated 'b->packets' is not deallocated on this path,
    leading to a memory leak.

    To fix the above issue, free 'b->packets' before returning the error code.

    Fixes: 31ef9134eb52 ("ALSA: add LaCie FireWire Speakers/Griffin FireWave Surround driver")
    Signed-off-by: Wenwen Wang
    Reviewed-by: Takashi Sakamoto
    Cc: # v2.6.39+
    Signed-off-by: Takashi Iwai

    Wenwen Wang
     
  • In sound_insert_unit(), the controlling structure 's' is allocated through
    kmalloc(). Then it is added to the sound driver list by invoking
    __sound_insert_unit(). Later on, if __register_chrdev() fails, 's' is
    removed from the list through __sound_remove_unit(). If 'index' is not less
    than 0, -EBUSY is returned to indicate the error. However, 's' is not
    deallocated on this execution path, leading to a memory leak bug.

    To fix the above issue, free 's' before -EBUSY is returned.

    Signed-off-by: Wenwen Wang
    Cc:
    Signed-off-by: Takashi Iwai

    Wenwen Wang
     

07 Aug, 2019

2 commits

  • A long-time problem on the recent AMD chip (X370, X470, B450, etc with
    PCI ID 1022:1457) with Realtek codecs is the crackled or distorted
    sound for capture streams, as well as occasional playback hiccups.
    After lengthy debugging sessions, the workarounds we've found are like
    the following:

    - Set up the proper driver caps for this controller, similar as the
    other AMD controller.

    - Correct the DMA position reporting with the fixed FIFO size, which
    is similar like as workaround used for VIA chip set.

    - Even after the position correction, PulseAudio still shows
    mysterious stalls of playback streams when a capture is triggered in
    timer-scheduled mode. Since we have no clear way to eliminate the
    stall, pass the BATCH PCM flag for PA to suppress the tsched mode as
    a temporary workaround.

    This patch implements the workarounds. For the driver caps, it
    defines a new preset, AXZ_DCAPS_PRESET_AMD_SB. It enables the FIFO-
    corrected position reporting (corresponding to the new position_fix=6)
    and enforces the SNDRV_PCM_INFO_BATCH flag.

    Note that the current implementation is merely a workaround.
    Hopefully we'll find a better alternative in future, especially about
    removing the BATCH flag hack again.

    BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=195303
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • In hiface_pcm_init(), 'rt' is firstly allocated through kzalloc(). Later
    on, hiface_pcm_init_urb() is invoked to initialize 'rt->out_urbs[i]'. In
    hiface_pcm_init_urb(), 'rt->out_urbs[i].buffer' is allocated through
    kzalloc(). However, if hiface_pcm_init_urb() fails, both 'rt' and
    'rt->out_urbs[i].buffer' are not deallocated, leading to memory leak bugs.
    Also, 'rt->out_urbs[i].buffer' is not deallocated if snd_pcm_new() fails.

    To fix the above issues, free 'rt' and 'rt->out_urbs[i].buffer'.

    Fixes: a91c3fb2f842 ("Add M2Tech hiFace USB-SPDIF driver")
    Signed-off-by: Wenwen Wang
    Cc:
    Signed-off-by: Takashi Iwai

    Wenwen Wang
     

06 Aug, 2019

5 commits


03 Aug, 2019

2 commits

  • We shouldn't assume CPU physical address we get from page_to_phys()
    is same as DMA address we get from dma_alloc_coherent(). On x86_64,
    we won't run into any problem with the assumption when dma_ops is
    nommu_dma_ops. However, DMA address is IOVA when IOMMU is enabled.
    And it's most likely different from CPU physical address when AMD
    IOMMU is not in passthrough mode.

    This patch fixes page faults when IOMMU is enabled.

    Signed-off-by: Vijendar Mukunda
    Link: https://lore.kernel.org/r/1564753899-17124-2-git-send-email-Vijendar.Mukunda@amd.com
    Signed-off-by: Mark Brown

    Vijendar Mukunda
     
  • AMD platform device acp3x_rv_i2s created by parent PCI device
    driver. Pass struct device of the parent to
    snd_pcm_lib_preallocate_pages() so dma_alloc_coherent() can use
    correct dma_ops. Otherwise, it will use default dma_ops which
    is nommu_dma_ops on x86_64 even when IOMMU is enabled and
    set to non passthrough mode.

    Signed-off-by: Vijendar Mukunda
    Link: https://lore.kernel.org/r/1564753899-17124-1-git-send-email-Vijendar.Mukunda@amd.com
    Signed-off-by: Mark Brown

    Vijendar Mukunda
     

02 Aug, 2019

1 commit

  • Pull sound fixes from Takashi Iwai:

    - A further fix for syzcaller issues with USB-audio, addressing NULL
    dereference that was introduced by the recent fix

    - Avoid a long delay at boot with HD-audio when i915 module was built
    but not installed, found on some Debian systems

    - A fix of small race window at PCM draining

    * tag 'sound-5.3-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ALSA: usb-audio: Fix gpf in snd_usb_pipe_sanity_check
    ALSA: pcm: fix lost wakeup event scenarios in snd_pcm_drain
    ALSA: hda: Fix 1-minute detection delay when i915 module is not available

    Linus Torvalds
     

31 Jul, 2019

2 commits

  • 88200 and 96000 sampling rate was not enabled on driver, so can't be played.

    The error information:
    max98373 3-0031:rate 96000 not supported
    max98373 3-0031:ASoC: can't set max98373-aif1 hw params: -22

    Signed-off-by: fengchunguo
    Link: https://lore.kernel.org/r/20190731074156.5620-1-chunguo.feng@amlogic.com
    Signed-off-by: Mark Brown

    fengchunguo
     
  • The A64 audio codec uses the original I2S block but the SR and
    WSS computation currently assigned is for the newer block.

    Fixes: 619c15f7fac9 (ASoC: sun4i-i2s: Change SR and WSS computation)
    Signed-off-by: Marcus Cooper
    Link: https://lore.kernel.org/r/20190729152130.27955-1-codekipper@gmail.com
    Signed-off-by: Mark Brown

    Marcus Cooper
     

30 Jul, 2019

2 commits

  • syzbot found the following crash on:

    general protection fault: 0000 [#1] SMP KASAN
    RIP: 0010:snd_usb_pipe_sanity_check+0x80/0x130 sound/usb/helper.c:75
    Call Trace:
    snd_usb_motu_microbookii_communicate.constprop.0+0xa0/0x2fb sound/usb/quirks.c:1007
    snd_usb_motu_microbookii_boot_quirk sound/usb/quirks.c:1051 [inline]
    snd_usb_apply_boot_quirk.cold+0x163/0x370 sound/usb/quirks.c:1280
    usb_audio_probe+0x2ec/0x2010 sound/usb/card.c:576
    usb_probe_interface+0x305/0x7a0 drivers/usb/core/driver.c:361
    really_probe+0x281/0x650 drivers/base/dd.c:548
    ....

    It was introduced in commit 801ebf1043ae for checking pipe and endpoint
    types. It is fixed by adding a check of the ep pointer in question.

    BugLink: https://syzkaller.appspot.com/bug?extid=d59c4387bfb6eced94e2
    Reported-by: syzbot
    Fixes: 801ebf1043ae ("ALSA: usb-audio: Sanity checks for each pipe and EP types")
    Cc: Andrey Konovalov
    Signed-off-by: Hillf Danton
    Signed-off-by: Takashi Iwai

    Hillf Danton
     
  • lost wakeup can occur after enabling irq, therefore put task
    into interruptible before enabling interrupts,

    without this change, task can be put to sleep and snd_pcm_drain
    will delay

    Fixes: f2b3614cefb6 ("ALSA: PCM - Don't check DMA time-out too shortly")
    Signed-off-by: Yuki Tsunashima
    Signed-off-by: Suresh Udipi
    [ported from 4.9]
    Signed-off-by: Adam Miartus
    Signed-off-by: Takashi Iwai

    Yuki Tsunashima