11 Mar, 2018

1 commit


22 Feb, 2018

2 commits

  • commit 5e35dc0338d85ccebacf3f77eca1e5dea73155e8 upstream.

    Add quirk to ensure a sync endpoint is properly configured.
    This patch is a fix for same symptoms on Behringer UFX1204 as patch
    from Albertto Aquirre on Dec 8 2016 for Axe-Fx II.

    Signed-off-by: Lassi Ylikojola
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Lassi Ylikojola
     
  • commit 447cae58cecd69392b74a4a42cd0ab9cabd816af upstream.

    The layout of the UAC2 Control request and response varies depending on
    the request type. With the current implementation, only the Layout 2
    Parameter Block (with the 2-byte sized RANGE attribute) is handled
    properly. For the Control requests with the 1-byte sized RANGE attribute
    (Bass Control, Mid Control, Tremble Control), the response is parsed
    incorrectly.

    This commit:
    * fixes the wLength field value in the request
    * fixes parsing the range values from the response

    Fixes: 23caaf19b11e ("ALSA: usb-mixer: Add support for Audio Class v2.0")
    Signed-off-by: Kirill Marinushkin
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Kirill Marinushkin
     

30 Dec, 2017

2 commits

  • commit 5a15f289ee87eaf33f13f08a4909ec99d837ec5f upstream.

    The commit 89b89d121ffc ("ALSA: usb-audio: Add check return value for
    usb_string()") added the check of the return value from
    snd_usb_copy_string_desc(), which is correct per se, but it introduced
    a regression. In the original code, either the "Clock Source",
    "Playback Source" or "Capture Source" suffix is added after the
    terminal string, while the commit changed it to add the suffix only
    when get_term_name() is failing. It ended up with an incorrect ctl
    name like "PCM" instead of "PCM Capture Source".

    Also, even the original code has a similar bug: when the ctl name is
    generated from snd_usb_copy_string_desc() for the given iSelector, it
    also doesn't put the suffix.

    This patch addresses these issues: the suffix is added always when no
    static mapping is found. Also the patch tries to put more comments
    and cleans up the if/else block for better readability in order to
    avoid the same pitfall again.

    Fixes: 89b89d121ffc ("ALSA: usb-audio: Add check return value for usb_string()")
    Reported-and-tested-by: Mauro Santos
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 866f7ed7d67936dcdbcddc111c8af878c918fe7c upstream.

    Adds VID:PID of Esoteric D-05X to the TEAC device id's.
    Renames the is_teac_50X_dac() function to is_teac_dsd_dac() to cover
    broader device family from the same corporation sharing the same USB
    audio implementation.

    Signed-off-by: Jussi Laako
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Jussi Laako
     

14 Dec, 2017

2 commits

  • commit 89b89d121ffcf8d9546633b98ded9d18b8f75891 upstream.

    snd_usb_copy_string_desc() returns zero if usb_string() fails.
    In case of failure, we need to check the snd_usb_copy_string_desc()'s
    return value and add an exception case

    Signed-off-by: Jaejoong Kim
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Jaejoong Kim
     
  • commit 251552a2b0d454badc8f486e6d79100970c744b0 upstream.

    The snd_usb_copy_string_desc() retrieves the usb string corresponding to
    the index number through the usb_string(). The problem is that the
    usb_string() returns the length of the string (>= 0) when successful, but
    it can also return a negative value about the error case or status of
    usb_control_msg().

    If iClockSource is '0' as shown below, usb_string() will returns -EINVAL.
    This will result in '0' being inserted into buf[-22], and the following
    KASAN out-of-bound error message will be output.

    AudioControl Interface Descriptor:
    bLength 8
    bDescriptorType 36
    bDescriptorSubtype 10 (CLOCK_SOURCE)
    bClockID 1
    bmAttributes 0x07 Internal programmable Clock (synced to SOF)
    bmControls 0x07
    Clock Frequency Control (read/write)
    Clock Validity Control (read-only)
    bAssocTerminal 0
    iClockSource 0

    To fix it, check usb_string()'return value and bail out.

    ==================================================================
    BUG: KASAN: stack-out-of-bounds in parse_audio_unit+0x1327/0x1960 [snd_usb_audio]
    Write of size 1 at addr ffff88007e66735a by task systemd-udevd/18376

    CPU: 0 PID: 18376 Comm: systemd-udevd Not tainted 4.13.0+ #3
    Hardware name: LG Electronics 15N540-RFLGL/White Tip Mountain, BIOS 15N5
    Call Trace:
    dump_stack+0x63/0x8d
    print_address_description+0x70/0x290
    ? parse_audio_unit+0x1327/0x1960 [snd_usb_audio]
    kasan_report+0x265/0x350
    __asan_store1+0x4a/0x50
    parse_audio_unit+0x1327/0x1960 [snd_usb_audio]
    ? save_stack+0xb5/0xd0
    ? save_stack_trace+0x1b/0x20
    ? save_stack+0x46/0xd0
    ? kasan_kmalloc+0xad/0xe0
    ? kmem_cache_alloc_trace+0xff/0x230
    ? snd_usb_create_mixer+0xb0/0x4b0 [snd_usb_audio]
    ? usb_audio_probe+0x4de/0xf40 [snd_usb_audio]
    ? usb_probe_interface+0x1f5/0x440
    ? driver_probe_device+0x3ed/0x660
    ? build_feature_ctl+0xb10/0xb10 [snd_usb_audio]
    ? save_stack_trace+0x1b/0x20
    ? init_object+0x69/0xa0
    ? snd_usb_find_csint_desc+0xa8/0xf0 [snd_usb_audio]
    snd_usb_mixer_controls+0x1dc/0x370 [snd_usb_audio]
    ? build_audio_procunit+0x890/0x890 [snd_usb_audio]
    ? snd_usb_create_mixer+0xb0/0x4b0 [snd_usb_audio]
    ? kmem_cache_alloc_trace+0xff/0x230
    ? usb_ifnum_to_if+0xbd/0xf0
    snd_usb_create_mixer+0x25b/0x4b0 [snd_usb_audio]
    ? snd_usb_create_stream+0x255/0x2c0 [snd_usb_audio]
    usb_audio_probe+0x4de/0xf40 [snd_usb_audio]
    ? snd_usb_autosuspend.part.7+0x30/0x30 [snd_usb_audio]
    ? __pm_runtime_idle+0x90/0x90
    ? kernfs_activate+0xa6/0xc0
    ? usb_match_one_id_intf+0xdc/0x130
    ? __pm_runtime_set_status+0x2d4/0x450
    usb_probe_interface+0x1f5/0x440

    Signed-off-by: Jaejoong Kim
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Jaejoong Kim
     

30 Nov, 2017

3 commits

  • commit 0a62d6c966956d77397c32836a5bbfe3af786fc1 upstream.

    The helper functions to parse and look for the clock source, selector
    and multiplier unit may return the descriptor with a too short length
    than required, while there is no sanity check in the caller side.
    Add some sanity checks in the parsers, at least, to guarantee the
    given descriptor size, for avoiding the potential crashes.

    Fixes: 79f920fbff56 ("ALSA: usb-audio: parse clock topology of UAC2 devices")
    Reported-by: Andrey Konovalov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit f658f17b5e0e339935dca23e77e0f3cad591926b upstream.

    The usb-audio driver may trigger an out-of-bound access at parsing a
    malformed selector unit, as it checks the header length only after
    evaluating bNrInPins field, which can be already above the given
    length. Fix it by adding the length check beforehand.

    Fixes: 99fc86450c43 ("ALSA: usb-mixer: parse descriptors with structs")
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit d937cd6790a2bef2d07b500487646bd794c039bb upstream.

    When the usb-audio descriptor contains the malformed feature unit
    description with a too short length, the driver may access
    out-of-bounds. Add a sanity check of the header size at the beginning
    of parse_audio_feature_unit().

    Fixes: 23caaf19b11e ("ALSA: usb-mixer: Add support for Audio Class v2.0")
    Reported-by: Andrey Konovalov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

27 Oct, 2017

1 commit


18 Oct, 2017

4 commits

  • commit c95072b3d88fac4be295815f2b67df366c0c297f upstream.

    While line6_probe() may kick off URB for a control MIDI endpoint, the
    function doesn't clean up it properly at its error path. This results
    in a leftover URB action that is eventually triggered later and causes
    an Oops like:
    general protection fault: 0000 [#1] PREEMPT SMP KASAN
    CPU: 1 PID: 0 Comm: swapper/1 Not tainted
    RIP: 0010:usb_fill_bulk_urb ./include/linux/usb.h:1619
    RIP: 0010:line6_start_listen+0x3fe/0x9e0 sound/usb/line6/driver.c:76
    Call Trace:

    line6_data_received+0x1f7/0x470 sound/usb/line6/driver.c:326
    __usb_hcd_giveback_urb+0x2e0/0x650 drivers/usb/core/hcd.c:1779
    usb_hcd_giveback_urb+0x337/0x420 drivers/usb/core/hcd.c:1845
    dummy_timer+0xba9/0x39f0 drivers/usb/gadget/udc/dummy_hcd.c:1965
    call_timer_fn+0x2a2/0x940 kernel/time/timer.c:1281
    ....

    Since the whole clean-up procedure is done in line6_disconnect()
    callback, we can simply call it in the error path instead of
    open-coding the whole again. It'll fix such an issue automagically.

    The bug was spotted by syzkaller.

    Fixes: eedd0e95d355 ("ALSA: line6: Don't forget to call driver's destructor at error path")
    Reported-by: Andrey Konovalov
    Tested-by: Andrey Konovalov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit cb02ffc76a53b5ea751b79b8d4f4d180e5868475 upstream.

    The error path in podhd_init() tries to clear the pending timer, while
    the timer object is initialized at the end of init sequence, thus it
    may hit the uninitialized object, as spotted by syzkaller:

    INFO: trying to register non-static key.
    the code is fine but needs lockdep annotation.
    turning off the locking correctness validator.
    CPU: 1 PID: 1845 Comm: kworker/1:2 Not tainted
    4.14.0-rc2-42613-g1488251d1a98 #238
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
    Workqueue: usb_hub_wq hub_event
    Call Trace:
    __dump_stack lib/dump_stack.c:16
    dump_stack+0x292/0x395 lib/dump_stack.c:52
    register_lock_class+0x6c4/0x1a00 kernel/locking/lockdep.c:769
    __lock_acquire+0x27e/0x4550 kernel/locking/lockdep.c:3385
    lock_acquire+0x259/0x620 kernel/locking/lockdep.c:4002
    del_timer_sync+0x12c/0x280 kernel/time/timer.c:1237
    podhd_disconnect+0x8c/0x160 sound/usb/line6/podhd.c:299
    line6_probe+0x844/0x1310 sound/usb/line6/driver.c:783
    podhd_probe+0x64/0x70 sound/usb/line6/podhd.c:474
    ....

    For addressing it, assure the initializations of timer and work by
    moving them to the beginning of podhd_init().

    Fixes: 790869dacc3d ("ALSA: line6: Add support for POD X3")
    Reported-by: Andrey Konovalov
    Tested-by: Andrey Konovalov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 99fee508245825765ff60155fed43f970ff83a8f upstream.

    caiaq driver doesn't kill the URB properly at its error path during
    the probe, which may lead to a use-after-free error later. This patch
    addresses it.

    Reported-by: Johan Hovold
    Reviewed-by: Johan Hovold
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 124751d5e63c823092060074bd0abaae61aaa9c4 upstream.

    USB-audio driver may leave a stray URB for the mixer interrupt when it
    exits by some error during probe. This leads to a use-after-free
    error as spotted by syzkaller like:
    ==================================================================
    BUG: KASAN: use-after-free in snd_usb_mixer_interrupt+0x604/0x6f0
    Call Trace:

    __dump_stack lib/dump_stack.c:16
    dump_stack+0x292/0x395 lib/dump_stack.c:52
    print_address_description+0x78/0x280 mm/kasan/report.c:252
    kasan_report_error mm/kasan/report.c:351
    kasan_report+0x23d/0x350 mm/kasan/report.c:409
    __asan_report_load8_noabort+0x19/0x20 mm/kasan/report.c:430
    snd_usb_mixer_interrupt+0x604/0x6f0 sound/usb/mixer.c:2490
    __usb_hcd_giveback_urb+0x2e0/0x650 drivers/usb/core/hcd.c:1779
    ....

    Allocated by task 1484:
    save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59
    save_stack+0x43/0xd0 mm/kasan/kasan.c:447
    set_track mm/kasan/kasan.c:459
    kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
    kmem_cache_alloc_trace+0x11e/0x2d0 mm/slub.c:2772
    kmalloc ./include/linux/slab.h:493
    kzalloc ./include/linux/slab.h:666
    snd_usb_create_mixer+0x145/0x1010 sound/usb/mixer.c:2540
    create_standard_mixer_quirk+0x58/0x80 sound/usb/quirks.c:516
    snd_usb_create_quirk+0x92/0x100 sound/usb/quirks.c:560
    create_composite_quirk+0x1c4/0x3e0 sound/usb/quirks.c:59
    snd_usb_create_quirk+0x92/0x100 sound/usb/quirks.c:560
    usb_audio_probe+0x1040/0x2c10 sound/usb/card.c:618
    ....

    Freed by task 1484:
    save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59
    save_stack+0x43/0xd0 mm/kasan/kasan.c:447
    set_track mm/kasan/kasan.c:459
    kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:524
    slab_free_hook mm/slub.c:1390
    slab_free_freelist_hook mm/slub.c:1412
    slab_free mm/slub.c:2988
    kfree+0xf6/0x2f0 mm/slub.c:3919
    snd_usb_mixer_free+0x11a/0x160 sound/usb/mixer.c:2244
    snd_usb_mixer_dev_free+0x36/0x50 sound/usb/mixer.c:2250
    __snd_device_free+0x1ff/0x380 sound/core/device.c:91
    snd_device_free_all+0x8f/0xe0 sound/core/device.c:244
    snd_card_do_free sound/core/init.c:461
    release_card_device+0x47/0x170 sound/core/init.c:181
    device_release+0x13f/0x210 drivers/base/core.c:814
    ....

    Actually such a URB is killed properly at disconnection when the
    device gets probed successfully, and what we need is to apply it for
    the error-path, too.

    In this patch, we apply snd_usb_mixer_disconnect() at releasing.
    Also introduce a new flag, disconnected, to struct usb_mixer_interface
    for not performing the disconnection procedure twice.

    Reported-by: Andrey Konovalov
    Tested-by: Andrey Konovalov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

12 Oct, 2017

2 commits

  • commit 7682e399485fe19622b6fd82510b1f4551e48a25 upstream.

    The usx2y driver allocates the stream read/write buffers in continuous
    pages depending on the stream setup, and this may spew the kernel
    warning messages with a stack trace like:
    WARNING: CPU: 1 PID: 1846 at mm/page_alloc.c:3883
    __alloc_pages_slowpath+0x1ef2/0x2d70
    Modules linked in:
    CPU: 1 PID: 1846 Comm: kworker/1:2 Not tainted
    ....

    It may confuse user as if it were any serious error, although this is
    no fatal error and the driver handles the error case gracefully.
    Since the driver has already some sanity check of the given size (128
    and 256 pages), it can't pass any crazy value. So it's merely page
    fragmentation.

    This patch adds __GFP_NOWARN to each caller for suppressing such
    kernel warnings. The original issue was spotted by syzkaller.

    Reported-by: Andrey Konovalov
    Tested-by: Andrey Konovalov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit bfc81a8bc18e3c4ba0cbaa7666ff76be2f998991 upstream.

    When a USB-audio device receives a maliciously adjusted or corrupted
    buffer descriptor, the USB-audio driver may access an out-of-bounce
    value at its parser. This was detected by syzkaller, something like:

    BUG: KASAN: slab-out-of-bounds in usb_audio_probe+0x27b2/0x2ab0
    Read of size 1 at addr ffff88006b83a9e8 by task kworker/0:1/24
    CPU: 0 PID: 24 Comm: kworker/0:1 Not tainted 4.14.0-rc1-42251-gebb2c2437d80 #224
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
    Workqueue: usb_hub_wq hub_event
    Call Trace:
    __dump_stack lib/dump_stack.c:16
    dump_stack+0x292/0x395 lib/dump_stack.c:52
    print_address_description+0x78/0x280 mm/kasan/report.c:252
    kasan_report_error mm/kasan/report.c:351
    kasan_report+0x22f/0x340 mm/kasan/report.c:409
    __asan_report_load1_noabort+0x19/0x20 mm/kasan/report.c:427
    snd_usb_create_streams sound/usb/card.c:248
    usb_audio_probe+0x27b2/0x2ab0 sound/usb/card.c:605
    usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361
    really_probe drivers/base/dd.c:413
    driver_probe_device+0x610/0xa00 drivers/base/dd.c:557
    __device_attach_driver+0x230/0x290 drivers/base/dd.c:653
    bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463
    __device_attach+0x26e/0x3d0 drivers/base/dd.c:710
    device_initial_probe+0x1f/0x30 drivers/base/dd.c:757
    bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523
    device_add+0xd0b/0x1660 drivers/base/core.c:1835
    usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932
    generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174
    usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266
    really_probe drivers/base/dd.c:413
    driver_probe_device+0x610/0xa00 drivers/base/dd.c:557
    __device_attach_driver+0x230/0x290 drivers/base/dd.c:653
    bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463
    __device_attach+0x26e/0x3d0 drivers/base/dd.c:710
    device_initial_probe+0x1f/0x30 drivers/base/dd.c:757
    bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523
    device_add+0xd0b/0x1660 drivers/base/core.c:1835
    usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457
    hub_port_connect drivers/usb/core/hub.c:4903
    hub_port_connect_change drivers/usb/core/hub.c:5009
    port_event drivers/usb/core/hub.c:5115
    hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195
    process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119
    worker_thread+0x221/0x1850 kernel/workqueue.c:2253
    kthread+0x3a1/0x470 kernel/kthread.c:231
    ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431

    This patch adds the checks of out-of-bounce accesses at appropriate
    places and bails out when it goes out of the given buffer.

    Reported-by: Andrey Konovalov
    Tested-by: Andrey Konovalov
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

30 Aug, 2017

1 commit

  • commit 07b3b5e9ed807a0d2077319b8e43a42e941db818 upstream.

    These headsets reports a lot of: cannot set freq 44100 to ep 0x81
    and need a small delay between sample rate settings, just like
    Zoom R16/24. Add both headsets to the Zoom R16/24 quirk for
    a 1 ms delay between control msgs.

    Signed-off-by: Joakim Tjernlund
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Joakim Tjernlund
     

25 Aug, 2017

2 commits

  • commit 0f174b3525a43bd51f9397394763925e0ebe7bc7 upstream.

    C-Media devices (at least some models) mute the playback stream when
    volumes are set to the minimum value. But this isn't informed via TLV
    and the user-space, typically PulseAudio, gets confused as if it's
    still played in a low volume.

    This patch adds the new flag, min_mute, to struct usb_mixer_elem_info
    for indicating that the mixer element is with the minimum-mute volume.
    This flag is set for known C-Media devices in
    snd_usb_mixer_fu_apply_quirk() in turn.

    Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=196669
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit a8e800fe0f68bc28ce309914f47e432742b865ed upstream.

    A Senheisser headset requires the typical sample-rate quirk for
    avoiding spurious errors from inquiring the current sample rate like:
    usb 1-1: 2:1: cannot get freq at ep 0x4
    usb 1-1: 3:1: cannot get freq at ep 0x83

    The USB ID 1395:740a has to be added to the entries in
    snd_usb_get_sample_rate_quirk().

    Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1052580
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

07 Aug, 2017

1 commit

  • [ Upstream commit 13a6c8328e6056932dc680e447d4c5e8ad9add17 ]

    Testing EP_FLAG_RUNNING in snd_complete_urb() before running the completion
    logic allows us to save a few cpu cycles by returning early, skipping the
    pending urb in case the stream was stopped; the stop logic handles the urb
    and sets the completion callbacks to NULL.

    Signed-off-by: Ioan-Adrian Ratiu
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Ioan-Adrian Ratiu
     

12 Apr, 2017

2 commits

  • [ Upstream commit 7f38ca047b0cb54df7f6d9e4110e292e45dba6ad ]

    This patch adds native DSD support for the following devices.

    - TEAC NT-503
    - TEAC UD-503
    - TEAC UD-501

    (1) Add quirks for native DSD support for TEAC devices.
    (2) A specific vendor command is needed to switch between PCM/DOP and
    DSD mode, same as Denon/Marantz devices.

    Signed-off-by: Nobutaka Okabe
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Nobutaka Okabe
     
  • [ Upstream commit 17f08b0d9aafccdb10038ab6dbd9ddb6433c13e2 ]

    The Axe-Fx II implicit feedback end point and the data sync endpoint
    are in different interface descriptors. Add quirk to ensure a sync
    endpoint is properly configured.

    Signed-off-by: Alberto Aguirre
    Signed-off-by: Takashi Iwai
    Signed-off-by: Sasha Levin
    Signed-off-by: Greg Kroah-Hartman

    Alberto Aguirre
     

15 Feb, 2017

1 commit

  • commit f3d83317a69e7d658e7c83e24f8b31ac533c39e3 upstream.

    This reverts commit f6a0dd107ad0c8b59d1c9735eea4b8cb9f460949.

    The commit caused a regression on LINE6 Transport that has no control
    caps. Although reverting the commit may result back in a spurious
    error message for some device again, it's the simplest regression fix,
    hence it's taken as is at first. The further code fix will follow
    later.

    Fixes: f6a0dd107ad0 ("ALSA: line6: Only determine control port properties if needed")
    Reported-by: Igor Zinovev
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

15 Jan, 2017

1 commit

  • commit 2e40795c3bf344cfb5220d94566205796e3ef19a upstream.

    Plantronics BT600 does not support reading the sample rate which leads
    to many lines of "cannot get freq at ep 0x1" and "cannot get freq at
    ep 0x82". This patch adds the USB ID of the BT600 to quirks.c and
    avoids those error messages.

    Signed-off-by: Dennis Kadioglu
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Dennis Kadioglu
     

12 Jan, 2017

2 commits

  • commit 4763601a56f155ddf94ef35fc2c41504a2de15f5 upstream.

    The function returns -EINVAL even if it builds the stream properly.
    The bogus error code sneaked in during the code refactoring, but it
    wasn't noticed until now since the returned error code itself is
    ignored in anyway. Kill it here, but there is no behavior change by
    this patch, obviously.

    Fixes: e5779998bf8b ('ALSA: usb-audio: refactor code')
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     
  • commit 1d0f953086f090a022f2c0e1448300c15372db46 upstream.

    Commit 16200948d83 ("ALSA: usb-audio: Fix race at stopping the stream") was
    incomplete causing another more severe kernel panic, so it got reverted.
    This fixes both the original problem and its fallout kernel race/crash.

    The original fix is to move the endpoint member NULL clearing logic inside
    wait_clear_urbs() so the irq triggering the urb completion doesn't call
    retire_capture/playback_urb() after the NULL clearing and generate a panic.

    However this creates a new race between snd_usb_endpoint_start()'s call
    to wait_clear_urbs() and the irq urb completion handler which again calls
    retire_capture/playback_urb() leading to a new NULL dereference.

    We keep the EP deactivation code in snd_usb_endpoint_start() because
    removing it will break the EP reference counting (see [1] [2] for info),
    however we don't need the "can_sleep" mechanism anymore because a new
    function was introduced (snd_usb_endpoint_sync_pending_stop()) which
    synchronizes pending stops and gets called inside the pcm prepare callback.

    It also makes sense to remove can_sleep because it was also removed from
    deactivate_urbs() signature in [3] so we benefit from more simplification.

    [1] commit 015618b90 ("ALSA: snd-usb: Fix URB cancellation at stream start")
    [2] commit e9ba389c5 ("ALSA: usb-audio: Fix scheduling-while-atomic bug in PCM capture stream")
    [3] commit ccc1696d5 ("ALSA: usb-audio: simplify endpoint deactivation code")

    Fixes: f8114f8583bb ("Revert "ALSA: usb-audio: Fix race at stopping the stream"")

    Signed-off-by: Ioan-Adrian Ratiu
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Ioan-Adrian Ratiu
     

06 Jan, 2017

2 commits

  • commit 995c6a7fd9b9212abdf01160f6ce3193176be503 upstream.

    Sampling rate changes after first set one are not reflected to the
    hardware, while driver and ALSA think the rate has been changed.

    Fix the problem by properly stopping the interface at the beginning of
    prepare call, allowing new rate to be set to the hardware. This keeps
    the hardware in sync with the driver.

    Signed-off-by: Jussi Laako
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Jussi Laako
     
  • commit 82ffb6fc637150b279f49e174166d2aa3853eaf4 upstream.

    The Logitech QuickCam Communicate Deluxe/S7500 microphone fails with the
    following warning.

    [ 6.778995] usb 2-1.2.2.2: Warning! Unlikely big volume range (=3072),
    cval->res is probably wrong.
    [ 6.778996] usb 2-1.2.2.2: [5] FU [Mic Capture Volume] ch = 1, val =
    4608/7680/1

    Adding it to the list of devices in volume_control_quirks makes it work
    properly, fixing related typo.

    Signed-off-by: Con Kolivas
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Con Kolivas
     

15 Nov, 2016

1 commit

  • The usb-audio driver implements the deferred device disconnection for
    the device in use. In this mode, the disconnection callback returns
    immediately while the actual ALSA card object removal happens later
    when all files get closed. As Shuah reported, this code flow,
    however, leads to a use-after-free, detected by KASAN:

    BUG: KASAN: use-after-free in snd_usb_audio_free+0x134/0x160 [snd_usb_audio] at addr ffff8801c863ce10
    Write of size 8 by task pulseaudio/2244
    Call Trace:
    [] dump_stack+0x67/0x94
    [] kasan_object_err+0x21/0x70
    [] kasan_report_error+0x1fa/0x4e0
    [] ? kasan_slab_free+0x87/0xb0
    [] __asan_report_store8_noabort+0x43/0x50
    [] ? snd_usb_audio_free+0x134/0x160 [snd_usb_audio]
    [] snd_usb_audio_free+0x134/0x160 [snd_usb_audio]
    [] snd_usb_audio_dev_free+0x31/0x40 [snd_usb_audio]
    [] __snd_device_free+0x12a/0x210
    [] snd_device_free_all+0x85/0xd0
    [] release_card_device+0x34/0x130
    [] device_release+0x76/0x1e0
    [] kobject_release+0x107/0x370
    .....
    Object at ffff8801c863cc80, in cache kmalloc-2048 size: 2048
    Allocated:
    [] save_stack_trace+0x2b/0x50
    [] save_stack+0x46/0xd0
    [] kasan_kmalloc+0xad/0xe0
    [] kmem_cache_alloc_trace+0xfa/0x240
    [] usb_alloc_dev+0x57/0xc90
    [] hub_event+0xf1d/0x35f0
    ....
    Freed:
    [] save_stack_trace+0x2b/0x50
    [] save_stack+0x46/0xd0
    [] kasan_slab_free+0x71/0xb0
    [] kfree+0xd9/0x280
    [] usb_release_dev+0xde/0x110
    [] device_release+0x76/0x1e0
    ....

    It's the code trying to clear drvdata of the assigned usb_device where
    the usb_device itself was already released in usb_release_dev() after
    the disconnect callback.

    This patch fixes it by checking whether the code path is via the
    disconnect callback, i.e. chip->shutdown flag is set.

    Fixes: 79289e24194a ('ALSA: usb-audio: Refer to chip->usb_id for quirks...')
    Reported-and-tested-by: Shuah Khan
    Cc: # v4.6+
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

27 Oct, 2016

1 commit

  • The stk1160 chip needs QUIRK_AUDIO_ALIGN_TRANSFER. This patch resolves
    the issue reported on the mailing list
    (http://marc.info/?l=linux-sound&m=139223599126215&w=2) and also fixes
    bug 180071 (https://bugzilla.kernel.org/show_bug.cgi?id=180071).

    Signed-off-by: Marcel Hasler
    Cc:
    Signed-off-by: Takashi Iwai

    Marcel Hasler
     

13 Oct, 2016

1 commit


10 Oct, 2016

1 commit

  • The commit c039aaa77a7d1d9375665a8b59ec16dc7d23e259 was incomplete,
    missing part of the setup for Live. This makes also audio input work,
    in addition to audio output.

    Fixes: c039aaa77a7d1d9375665a8b59ec16dc7d23e259
    Reported-by: Eddi De Pieri
    Signed-off-by: Andrej Krutak
    Signed-off-by: Takashi Iwai

    Andrej Krutak
     

30 Sep, 2016

1 commit


26 Sep, 2016

1 commit

  • Currently, usb-line6 module exports an array of MIDI manufacturer ID and
    usb-pod module uses it. However, the declaration is not the definition in
    common header. The difference is explicit length of array. Although
    compiler calculates it and everything goes well, it's better to use the
    same representation between definition and declaration.

    This commit fills the length of array for usb-line6 module. As a small
    good sub-effect, this commit suppress below warnings from static analysis
    by sparse v0.5.0.

    sound/usb/line6/driver.c:274:43: error: cannot size expression
    sound/usb/line6/driver.c:275:16: error: cannot size expression
    sound/usb/line6/driver.c:276:16: error: cannot size expression
    sound/usb/line6/driver.c:277:16: error: cannot size expression

    Fixes: 705ececd1c60 ("Staging: add line6 usb driver")
    Signed-off-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Takashi Sakamoto
     

23 Sep, 2016

1 commit

  • The DragonFly quirk added in 42e3121d90f4 ("ALSA: usb-audio: Add a more
    accurate volume quirk for AudioQuest DragonFly") applies a custom dB map
    on the volume control when its range is reported as 0..50 (0 .. 0.2dB).

    However, there exists at least one other variant (hw v1.0c, as opposed
    to the tested v1.2) which reports a different non-sensical volume range
    (0..53) and the custom map is therefore not applied for that device.

    This results in all of the volume change appearing close to 100% on
    mixer UIs that utilize the dB TLV information.

    Add a fallback case where no dB TLV is reported at all if the control
    range is not 0..50 but still 0..N where N
    Reported-by: David W
    Tested-by: David W
    Cc:
    Signed-off-by: Takashi Iwai

    Anssi Hannula
     

21 Sep, 2016

1 commit

  • ERROR: "snd_hwdep_new" [sound/usb/line6/snd-usb-line6.ko] undefined!
    scripts/Makefile.modpost:91: recipe for target '__modpost' failed
    make[1]: *** [__modpost] Error 1

    Fixes: a16039cbf1a1 ('ALSA: line6: Add hwdep interface to access the POD control messages')
    Signed-off-by: Valdis Kletnieks
    Reviewed-by: Takashi Sakamoto
    Signed-off-by: Takashi Iwai

    Valdis Kletnieks
     

20 Sep, 2016

3 commits

  • sound/usb/line6/driver.c:484:2-7: WARNING: NULL check before freeing functions like kfree, debugfs_remove, debugfs_remove_recursive or usb_free_urb is not needed. Maybe consider reorganizing relevant code to avoid passing NULL values.

    NULL check before some freeing functions is not needed.

    Based on checkpatch warning
    "kfree(NULL) is safe this check is probably not required"
    and kfreeaddr.cocci by Julia Lawall.

    Generated by: scripts/coccinelle/free/ifnullfree.cocci

    CC: Andrej Krutak
    Signed-off-by: Fengguang Wu
    Signed-off-by: Takashi Iwai

    kbuild test robot
     
  • We must do it this way, because e.g. POD X3 won't play any sound unless
    the host listens on the bulk EP, so we cannot export it only via libusb.

    The driver currently doesn't use the bulk EP messages in other way,
    in future it could e.g. sense/modify volume(s).

    Signed-off-by: Andrej Krutak
    Signed-off-by: Takashi Iwai

    Andrej Krutak
     
  • Only initialize PCM for POD HD devices that support it.
    No POD HD seems to support MIDI, thus drop the initialization.

    Signed-off-by: Andrej Krutak
    Signed-off-by: Takashi Iwai

    Andrej Krutak