26 Sep, 2018

1 commit

  • [ Upstream commit bd1cd0eb2ce9141100628d476ead4de485501b29 ]

    AU0828_DEVICE() macro in quirks-table.h uses USB_DEVICE_VENDOR_SPEC()
    for expanding idVendor and idProduct fields. However, the latter
    macro adds also match_flags and bInterfaceClass, which are different
    from the values AU0828_DEVICE() macro sets after that.

    For fixing them, just expand idVendor and idProduct fields manually in
    AU0828_DEVICE().

    This fixes sparse warnings like:
    sound/usb/quirks-table.h:2892:1: warning: Initializer entry defined twice

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

    Takashi Iwai
     

03 Aug, 2018

1 commit


25 May, 2018

1 commit

  • [ Upstream commit 71426535f49fe6034d0e0db77608b91a0c1a022d ]

    Add native DSD support quirk for Luxman DA-06 DAC, by adding the
    PID/VID 1852:5065.

    Rename "is_marantz_denon_dac()" function to "is_itf_usb_dsd_2alts_dac()"
    to cover broader device family sharing the same USB audio
    implementation(*).
    For the same reason, rename "is_teac_dsd_dac()" function to
    "is_itf_usb_dsd_3alts_dac()".

    (*)
    These devices have the same USB controller "ITF-USB DSD", supplied by
    INTERFACE Co., Ltd.
    "ITF-USB DSD" USB controller has two patterns,

    Pattern 1. (2 altsets version)
    - Altset 0: for control
    - Altset 1: for stream (S32)
    - Altset 2: for stream (S32, DSD_U32)

    Pattern 2. (3 altsets version)
    - Altset 0: for control
    - Altset 1: for stream (S16)
    - Altset 2: for stream (S32)
    - Altset 3: for stream (S32, DSD_U32)

    "is_itf_usb_dsd_2alts_dac()" returns true, if the DAC has "Pattern 1"
    USB controller, and "is_itf_usb_dsd_3alts_dac()" returns true, if
    "Pattern2".

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

    Nobutaka Okabe
     

23 May, 2018

1 commit

  • commit 21493316a3c4598f308d5a9fa31cc74639c4caff upstream.

    Currently it's not possible to set volume lower than 26% (it just mutes).

    Also fixes this warning:

    Warning! Unlikely big volume range (=9472), cval->res is probably wrong.
    [13] FU [PCM Playback Volume] ch = 2, val = -9473/-1/1

    , and volume works fine for full range.

    Signed-off-by: Federico Cuello
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Federico Cuello
     

02 May, 2018

1 commit

  • commit 1d8d6428d1da642ddd75b0be2d1bb1123ff8e017 upstream.

    The Dell Dock USB-audio device with 0bda:4014 is behaving notoriously
    bad, and we have already applied some workaround to avoid the firmware
    hiccup. Yet we still need to skip one thing, the Extension Unit at ID
    4, which doesn't react correctly to the mixer ctl access.

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

    Takashi Iwai
     

24 Apr, 2018

1 commit

  • commit 7ecb46e9ee9af18e304eb9e7d6804c59a408e846 upstream.

    Sending MIDI messages to a PODxt through the USB connection shows
    "usb_submit_urb failed" in dmesg and the message is not received by
    the POD.

    The error is caused because in the funcion send_midi_async() in midi.c
    there is a call to usb_sndbulkpipe() for endpoint 3 OUT, but the PODxt
    USB descriptor shows that this endpoint it's an interrupt endpoint.

    Patch tested with PODxt only.

    [ The bug has been present from the very beginning in the staging
    driver time, but Fixes below points to the commit moving to sound/
    directory so that the fix can be cleanly applied -- tiwai ]

    Fixes: 61864d844c29 ("ALSA: move line6 usb driver into sound/usb")
    Signed-off-by: Fabián Inostroza
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Fabián Inostroza
     

08 Apr, 2018

1 commit


09 Mar, 2018

1 commit


25 Feb, 2018

3 commits

  • commit 6815a0b444572527256f0d0efd8efe3ddede6018 upstream.

    As syzkaller spotted, currently bcd2000 driver submits a URB with the
    fixed EP without checking whether it's actually available, which may
    result in a kernel warning like:
    usb 1-1: BOGUS urb xfer, pipe 1 != type 3
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 1846 at drivers/usb/core/urb.c:449
    usb_submit_urb+0xf8a/0x11d0
    Modules linked in:
    CPU: 0 PID: 1846 Comm: kworker/0: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:
    bcd2000_init_device sound/usb/bcd2000/bcd2000.c:289
    bcd2000_init_midi sound/usb/bcd2000/bcd2000.c:345
    bcd2000_probe+0xe64/0x19e0 sound/usb/bcd2000/bcd2000.c:406
    usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361
    ....

    This patch adds a sanity check of validity of EPs at the device
    initialization phase for avoiding the call with an invalid EP.

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

    Takashi Iwai
     
  • commit 58fc7f73a85d45a47057dad2af53502fdf6cf778 upstream.

    As syzkaller spotted, currently caiaq driver submits a URB with the
    fixed EP without checking whether it's actually available, which may
    result in a kernel warning like:
    usb 1-1: BOGUS urb xfer, pipe 3 != type 1
    ------------[ cut here ]------------
    WARNING: CPU: 1 PID: 1150 at drivers/usb/core/urb.c:449
    usb_submit_urb+0xf8a/0x11d0
    Modules linked in:
    CPU: 1 PID: 1150 Comm: kworker/1:1 Not tainted
    4.14.0-rc2-42660-g24b7bd59eec0 #277
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
    Workqueue: usb_hub_wq hub_event
    Call Trace:
    init_card sound/usb/caiaq/device.c:467
    snd_probe+0x81c/0x1150 sound/usb/caiaq/device.c:525
    usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361
    ....

    This patch adds a sanity check of validity of EPs at the device
    initialization phase for avoiding the call with an invalid EP.

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

    Takashi Iwai
     
  • commit 2a4340c57717162c6bf07a0860d05711d4de994b upstream.

    As syzkaller spotted, currently line6 drivers submit a URB with the
    fixed EP without checking whether it's actually available, which may
    result in a kernel warning like:
    usb 1-1: BOGUS urb xfer, pipe 3 != type 1
    ------------[ cut here ]------------
    WARNING: CPU: 0 PID: 24 at drivers/usb/core/urb.c:449
    usb_submit_urb+0xf8a/0x11d0
    Modules linked in:
    CPU: 0 PID: 24 Comm: kworker/0:1 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:
    line6_start_listen+0x55f/0x9e0 sound/usb/line6/driver.c:82
    line6_init_cap_control sound/usb/line6/driver.c:690
    line6_probe+0x7c9/0x1310 sound/usb/line6/driver.c:764
    podhd_probe+0x64/0x70 sound/usb/line6/podhd.c:474
    usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361
    ....

    This patch adds a sanity check of validity of EPs at the device
    initialization phase for avoiding the call with an invalid EP.

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

    Takashi Iwai
     

22 Feb, 2018

3 commits

  • commit 7c74866baef1827e18f8269aec85030063520bd4 upstream.

    Add some more devices that need quirks to handle DSD modes correctly.

    Signed-off-by: Daniel Mack
    Reported-and-tested-by: Thomas Gresens
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Daniel Mack
     
  • 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
     

10 Nov, 2017

1 commit

  • Pull sound fixes from Takashi Iwai:
    "The amount of the changes isn't as quite small as wished, nevertheless
    they are straight fixes that deserve merging to 4.14 final.

    Most of fixes are about ALSA core bugs spotted by fuzzer: a follow-up
    fix for the previous nested rwsem patch, a fix to avoid the resource
    hogs due to too many concurrent ALSA timer invocations, and a fix for
    a crash with SYSEX MIDI transfer over OSS sequencer emulation that is
    used by none but fuzzer.

    The rest are usual HD-audio and USB-audio device-specific quirks,
    which are safe to apply"

    * tag 'sound-4.14' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
    ALSA: hda - fix headset mic problem for Dell machines with alc274
    ALSA: seq: Fix OSS sysex delivery in OSS emulation
    ALSA: seq: Avoid invalid lockdep class warning
    ALSA: timer: Limit max instances per timer
    ALSA: usb-audio: support new Amanero Combo384 firmware version

    Linus Torvalds
     

02 Nov, 2017

2 commits

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • Support DSD_U32_BE sample format on new Amanero Combo384 firmware
    version on older VID/PID.

    Fixes: 3eff682d765b ("ALSA: usb-audio: Support both DSD LE/BE Amanero firmware versions")
    Signed-off-by: Jussi Laako
    Cc:
    Signed-off-by: Takashi Iwai

    Jussi Laako
     

16 Oct, 2017

1 commit


11 Oct, 2017

1 commit


10 Oct, 2017

1 commit

  • 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
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

09 Oct, 2017

4 commits

  • 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
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • When podhd_init() failed with the acquiring a ctrl i/f, the line6
    helper still calls the disconnect callback that eventually calls again
    usb_driver_release_interface() with the NULL intf.

    Put the proper NULL check before calling it for avoiding an Oops.

    Fixes: fc90172ba283 ("ALSA: line6: Claim pod x3 usb data interface")
    Reported-by: Andrey Konovalov
    Tested-by: Andrey Konovalov
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • 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
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     
  • Like other Plantronics devices, P610 does not support sample
    rate reading. Apply sample rate quirk to it.

    BugLink: https://bugs.launchpad.net/bugs/1719853

    Signed-off-by: Kai-Heng Feng
    Signed-off-by: Takashi Iwai

    Kai-Heng Feng
     

03 Oct, 2017

1 commit

  • 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
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

22 Sep, 2017

1 commit

  • 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
    Cc:
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

21 Sep, 2017

1 commit


07 Sep, 2017

3 commits


31 Aug, 2017

2 commits


23 Aug, 2017

1 commit