This project is mirrored from Pull mirroring updated .
  1. 23 Nov, 2020 2 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: Refactor endpoint management · bf6313a0
      Takashi Iwai authored
      This is an intensive surgery for the endpoint and stream management
      for achieving more robust and clean code.
      The goals of this patch are:
      - More clear endpoint resource changes
      - The interface altsetting control in a single place
      Below are brief description of the whole changes.
      First off, most of the endpoint operations are moved into endpoint.c,
      so that the snd_usb_endpoint object is only referred in other places.
      The endpoint object is acquired and released via the new functions
      snd_usb_endpoint_open() and snd_usb_endpoint_close() that are called
      at PCM hw_params and hw_free callbacks, respectively.  Those are
      ref-counted and EPs can manage the multiple opens.
      The open callback receives the audioformat and hw_params arguments,
      and those are used for initializing the EP parameters; especially the
      endpoint, interface and altset numbers are read from there, as well as
      the PCM parameters like the format, rate and channels.  Those are
      stored in snd_usb_endpoint object.  If it's the secondary open, the
      function checks whether the given parameters are compatible with the
      already opened EP setup, too.
      The coupling with a sync EP (including an implicit feedback sync) is
      done by the sole snd_usb_endpoint_set_sync() call.
      The configuration of each endpoint is done in a single shot via
      snd_usb_endpoint_configure() call.  This is the place where most of
      PCM configurations are done.  A few flags and special handling in the
      snd_usb_substream are dropped along with this change.
      A significant difference wrt the configuration from the previous code
      is the order of USB host interface setups.  Now the interface is
      always disabled at beginning and (re-)enabled at the last step of
      snd_usb_endpoint_configure(), in order to be compliant with the
      standard UAC2/3.  For UAC1, the interface is set before the parameter
      setups since there seem devices that require it (e.g. Yamaha THR10),
      just like how it was done in the previous driver code.
      The start/stop are almost same as before, also single-shots.  The URB
      callbacks need to be set via snd_usb_endpoint_set_callback() like the
      previous code at the trigger phase, too.
      Finally, the flag for the re-setup is set at the device suspend
      through the full EP list, instead of PCM trigger.  This catches the
      overlooked cases where the PCM hasn't been running yet but the device
      needs the full setup after resume.
      Tested-by: default avatarKeith Milner <>
      Tested-by: default avatarDylan Robinson <>
      Signed-off-by: default avatarTakashi Iwai <>
    • Takashi Iwai's avatar
      ALSA: usb-audio: Drop debug.h · 7ec827b9
      Takashi Iwai authored
      The file debug.h contains a simple macro for debug prints, and it's
      used only in two places, the format parser and the hw_params rules.
      The former actually should print a more informative message instead,
      so the only users are the hw_parmas rules.
      This patch moves the contents of debug.h into the hw_params rules
      local code and remove the unneeded includes.  Also, the debug print in
      the format parser is replaced with the information print with more
      useful information, and the raw printk() call is replaced with
      Tested-by: default avatarKeith Milner <>
      Tested-by: default avatarDylan Robinson <>
      Signed-off-by: default avatarTakashi Iwai <>
  2. 16 Nov, 2020 1 commit
  3. 20 Aug, 2020 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Move device rename and profile quirks to an internal table · 5436f59b
      Takashi Iwai authored
      So far we've added the devices that need vendor/product string renames
      or the profile setup into the standard quirk table in quirks-table.h.
      This table is imported into the primary USB audio device entry, hence
      it's all exported for the probing so that udev and co can take a look
      at it.  OTOH, for renaming or profile setup, we don't need to expose
      those explicit entries because the probe itself follows the standard
      way.  That said, we're exposing unnecessarily too many entries.
      This patch moves such internal quirk entries into the own table, and
      reduces the exported device table size.  Along with the moving items,
      re-arrange the entries in the proper order.
      Signed-off-by: default avatarTakashi Iwai <>
  4. 09 Jul, 2020 1 commit
  5. 08 Jun, 2020 1 commit
  6. 04 Jun, 2020 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix inconsistent card PM state after resume · 862b2509
      Takashi Iwai authored
      When a USB-audio interface gets runtime-suspended via auto-pm feature,
      the driver suspends all functionality and increment
      chip->num_suspended_intf.  Later on, when the system gets suspended to
      S3, the driver increments chip->num_suspended_intf again, skips the
      device changes, and sets the card power state to
      SNDRV_CTL_POWER_D3hot.  In return, when the system gets resumed from
      S3, the resume callback decrements chip->num_suspended_intf.  Since
      this refcount is still not zero (it's been runtime-suspended), the
      whole resume is skipped.  But there is a small pitfall here.
      The problem is that the driver doesn't restore the card power state
      after this resume call, leaving it as SNDRV_CTL_POWER_D3hot.  So,
      even after the system resume finishes, the card instance still appears
      as if it were system-suspended, and this confuses many ioctl accesses
      that are blocked unexpectedly.
      In details, we have two issues behind the scene: one is that the card
      power state is changed only when the refcount becomes zero, and
      another is that the prior auto-suspend check is kept in a boolean
      flag.  Although the latter problem is almost negligible since the
      auto-pm feature is imposed only on the primary interface, but this can
      be a potential problem on the devices with multiple interfaces.
      This patch addresses those issues by the following:
      - Replace chip->autosuspended boolean flag with chip->system_suspend
      - At the first system-suspend, chip->num_suspended_intf is recorded to
      - At system-resume, the card power state is restored when the
        chip->num_suspended_intf refcount reaches to chip->system_suspend,
        i.e. the state returns to the auto-suspended
      Also, the patch fixes yet another hidden problem by the code
      refactoring along with the fixes above: namely, when some resume
      procedure failed, the driver left chip->num_suspended_intf that was
      already decreased, and it might lead to the refcount unbalance.
      In the new code, the refcount decrement is done after the whole resume
      procedure, and the problem is avoided as well.
      Fixes: 0662292a
       ("ALSA: usb-audio: Handle normal and auto-suspend equally")
      Reported-and-tested-by: default avatarMacpaul Lin <>
      Cc: <>
      Signed-off-by: default avatarTakashi Iwai <>
  7. 26 Mar, 2020 3 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: Inform devices that need delayed registration · a4aad563
      Takashi Iwai authored
      The USB-audio driver may call snd_card_register() multiple times as
      its probe function is per USB interface while some USB-audio devices
      may provide multiple interfaces to assign different streams although
      they belong to the same device.  This works in most cases but the
      registration is racy, hence it may miss the device recognition,
      e.g. PA doesn't see certain devices when hotplugged.
      The recent addition of the delayed registration quirk allows to sync
      the registration at the last known interface, and the previous commit
      added a new module option to allow the dynamic setup for that
      Now, this patch tries to find out and notifies for such devices that
      require the delayed registration.  It shows a message like:
        Found post-registration device assignment: 1234abcd:02
      If you hit this message, you can pass delayed_register module option
      by just copying the last shown entry.  If this works, it can be added
      statically in the quirk list, registration_quirks[] found at the end
      of sound/usb/quirks.c.
      Signed-off-by: default avatarTakashi Iwai <>
    • Takashi Iwai's avatar
      ALSA: usb-audio: Add delayed_register option · b70038ef
      Takashi Iwai authored
      Add a new option for specifying the quirk for delayed registration of
      the certain device.  A list of devices can be passed in a form
      where ID is the 32bit hex number combo of vendor and device IDs and
      IFACE is the interface number to trigger the register.
      When a matching device is probed, the card registration is delayed
      until the given interface is probed.  It's needed for syncing the
      registration until the last interface when multiple interfaces are
      provided for the same card.
      Signed-off-by: default avatarTakashi Iwai <>
    • Takashi Iwai's avatar
      ALSA: usb-audio: Rewrite registration quirk handling · d8695bc5
      Takashi Iwai authored
      A slight refactoring of the registration quirk code.  Now it uses the
      table lookup for easy additions in future.  Also the return type was
      changed to bool, and got a few more comments.
      Signed-off-by: default avatarTakashi Iwai <>
  8. 14 Mar, 2020 1 commit
  9. 15 Jan, 2020 1 commit
  10. 13 Jan, 2020 1 commit
  11. 14 Nov, 2019 1 commit
  12. 30 May, 2019 1 commit
  13. 22 Apr, 2019 1 commit
    • Shuah Khan's avatar
      media: sound/usb: Use Media Controller API to share media resources · 66354f18
      Shuah Khan authored
      Media Device Allocator API to allows multiple drivers share a media device.
      This API solves a very common use-case for media devices where one physical
      device (an USB stick) provides both audio and video. When such media device
      exposes a standard USB Audio class, a proprietary Video class, two or more
      independent drivers will share a single physical USB bridge. In such cases,
      it is necessary to coordinate access to the shared resource.
      Using this API, drivers can allocate a media device with the shared struct
      device as the key. Once the media device is allocated by a driver, other
      drivers can get a reference to it. The media device is released when all
      the references are released.
      Change the ALSA driver to use the Media Controller API to share media
      resources with DVB, and V4L2 drivers on a AU0828 media device.
      The Media Controller specific initialization is done after sound card is
      registered. ALSA creates Media interface and entity function graph nodes
      for Control, Mixer, PCM Playback, and PCM Capture devices.
      snd_usb_hw_params() will call Media Controller enable source handler
      interface to request the media resource. If resource request is granted,
      it will release it from snd_usb_hw_free(). If resource is busy, -EBUSY is
      Media specific cleanup is done in usb_audio_disconnect().
      Reviewed-by: default avatarTakashi Iwai <>
      Signed-off-by: default avatarShuah Khan <>
      Signed-off-by: default avatarHans Verkuil <>
      Signed-off-by: default avatarMauro Carvalho Chehab <>
  14. 15 Jan, 2019 1 commit
  15. 07 Jan, 2019 1 commit
  16. 03 Dec, 2018 1 commit
  17. 31 Jul, 2018 1 commit
  18. 29 May, 2018 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Allow non-vmalloc buffer for PCM buffers · f274baa4
      Takashi Iwai authored
      Currently, USB-audio driver allocates the PCM buffer via vmalloc(), as
      this serves merely as an intermediate buffer that is copied to each
      URB transfer buffer.  This works well in general on x86, but on some
      archs this may result in cache coherency issues when mmap is used.
      OTOH, it works also on such arch unless mmap is used.
      This patch is a step for mitigating the inconvenience; a new module
      option "use_vmalloc" is provided so that user can choose to allocate
      the DMA coherent buffer instead of the existing vmalloc buffer.
      The drawback is that it'd be the standard dma_alloc_coherent() calls
      and the system would require contiguous pages on non-x86 archs.
      Note that it's a global option and not dynamically switchable since
      the buffer is pre-allocated at the probe time.  In theory, it's
      possible to be switchable, but it'd be trickier and racier.
      As default use_vmalloc option is set to true, so that the old behavior
      is kept.  For allowing the coherent mmap on ARM or MIPS, pass
      use_vmalloc=0 option explicitly.
      Reported-and-tested-by: default avatarDaniel Danzberger <>
      Signed-off-by: default avatarTakashi Iwai <>
  19. 28 May, 2018 2 commits
  20. 13 May, 2018 1 commit
    • Ruslan Bilovol's avatar
      ALSA: usb: add UAC3 BADD profiles support · 17156f23
      Ruslan Bilovol authored
      Recently released USB Audio Class 3.0 specification
      contains BADD (Basic Audio Device Definition) document
      which describes pre-defined UAC3 configurations.
      BADD support is mandatory for UAC3 devices, it should be
      implemented as a separate USB device configuration.
      As per BADD document, class-specific descriptors
      shall not be included in the Device’s Configuration
      descriptor ("inferred"), but host can guess them
      from BADD profile number, number of endpoints and
      their max packed sizes.
      This patch adds support of all BADD profiles from the spec
      Signed-off-by: default avatarRuslan Bilovol <>
      Tested-by: default avatarJorge Sanjuan <>
      Signed-off-by: default avatarTakashi Iwai <>
  21. 04 May, 2018 1 commit
  22. 02 May, 2018 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Allow to override the longname string · 07eca5fc
      Takashi Iwai authored
      Historically USB-audio driver sets the card's longname field with the
      details of the device and the bus information.  It's good per se, but
      not preferable when it's referred as the identifier for UCM profile.
      This patch adds a quirk profile_name field to override the card's
      longname string to a pre-defined one, so that one can create a unique
      and consistent ID string for the specific USB device via a quirk table
      to be used as a UCM profile name.
      The patch does a slight code refactoring to split out the functions to
      set shortname and longname fields as well.
      Signed-off-by: default avatarTakashi Iwai <>
  23. 21 Mar, 2018 1 commit
    • Ruslan Bilovol's avatar
      ALSA: usb: initial USB Audio Device Class 3.0 support · 9a2fe9b8
      Ruslan Bilovol authored
      Recently released USB Audio Class 3.0 specification
      introduces many significant changes comparing to
      previous versions, like
       - new Power Domains, support for LPM/L1
       - new Cluster descriptor
       - changed layout of all class-specific descriptors
       - new High Capability descriptors
       - New class-specific String descriptors
       - new and removed units
       - additional sources for interrupts
       - removed Type II Audio Data Formats
       - ... and many other things (check spec)
      It also provides backward compatibility through
      multiple configurations, as well as requires
      mandatory support for BADD (Basic Audio Device
      Definition) on each ADC3.0 compliant device
      This patch adds initial support of UAC3 specification
      that is enough for Generic I/O Profile (BAOF, BAIF)
      device support from BADD document.
      Signed-off-by: default avatarRuslan Bilovol <>
      Reviewed-by: default avatarGreg Kroah-Hartman <>
      Signed-off-by: default avatarTakashi Iwai <>
  24. 30 Nov, 2017 1 commit
  25. 22 Sep, 2017 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Check out-of-bounds access by corrupted buffer descriptor · bfc81a8b
      Takashi Iwai authored
      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-gebb2c243
        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: default avatarAndrey Konovalov <>
      Tested-by: default avatarAndrey Konovalov <>
      Cc: <>
      Signed-off-by: default avatarTakashi Iwai <>
  26. 06 Aug, 2017 1 commit
  27. 31 Mar, 2017 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fake also USB device id when alias is given · 03a1f48e
      Takashi Iwai authored
      Recently snd-usb-audio driver received a new option, quirk_alias, to
      allow user to apply the existing quirk for a different device.  This
      works for many quirks as is, but some still need more tune-ups:
      namely, some quirks check the USB vendor/device IDs in various places,
      thus it doesn't work as long as the ID is different from the expected
      With this patch, the driver stores the aliased USB ID, so that these
      rest quirks per device ID are applied.  The transition to use the
      cached USB ID was already done in the past, so what we needed now is
      only to overwrite chip->usb_id.
      Signed-off-by: default avatarTakashi Iwai <>
  28. 29 Nov, 2016 1 commit
  29. 14 Nov, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix use-after-free of usb_device at disconnect · 6ff1a253
      Takashi Iwai authored
      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:
        [<ffffffff81b31473>] dump_stack+0x67/0x94
        [<ffffffff81564ef1>] kasan_object_err+0x21/0x70
        [<ffffffff8156518a>] kasan_report_error+0x1fa/0x4e0
        [<ffffffff81564ad7>] ? kasan_slab_free+0x87/0xb0
        [<ffffffff81565733>] __asan_report_store8_noabort+0x43/0x50
        [<ffffffffa0fc0f54>] ? snd_usb_audio_free+0x134/0x160 [snd_usb_audio]
        [<ffffffffa0fc0f54>] snd_usb_audio_free+0x134/0x160 [snd_usb_audio]
        [<ffffffffa0fc0fb1>] snd_usb_audio_dev_free+0x31/0x40 [snd_usb_audio]
        [<ffffffff8243c78a>] __snd_device_free+0x12a/0x210
        [<ffffffff8243d1f5>] snd_device_free_all+0x85/0xd0
        [<ffffffff8242cae4>] release_card_device+0x34/0x130
        [<ffffffff81ef1846>] device_release+0x76/0x1e0
        [<ffffffff81b37ad7>] kobject_release+0x107/0x370
       Object at ffff8801c863cc80, in cache kmalloc-2048 size: 2048
        [<ffffffff810804eb>] save_stack_trace+0x2b/0x50
        [<ffffffff81564296>] save_stack+0x46/0xd0
        [<ffffffff8156450d>] kasan_kmalloc+0xad/0xe0
        [<ffffffff81560d1a>] kmem_cache_alloc_trace+0xfa/0x240
        [<ffffffff8214ea47>] usb_alloc_dev+0x57/0xc90
        [<ffffffff8216349d>] hub_event+0xf1d/0x35f0
        [<ffffffff810804eb>] save_stack_trace+0x2b/0x50
        [<ffffffff81564296>] save_stack+0x46/0xd0
        [<ffffffff81564ac1>] kasan_slab_free+0x71/0xb0
        [<ffffffff81560929>] kfree+0xd9/0x280
        [<ffffffff8214de6e>] usb_release_dev+0xde/0x110
        [<ffffffff81ef1846>] 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: 79289e24
       ('ALSA: usb-audio: Refer to chip->usb_id for quirks...')
      Reported-and-tested-by: default avatarShuah Khan <>
      Cc: <> # v4.6+
      Signed-off-by: default avatarTakashi Iwai <>
  30. 18 Jul, 2016 1 commit
  31. 08 May, 2016 1 commit
  32. 31 Mar, 2016 1 commit
  33. 03 Mar, 2016 1 commit
  34. 29 Jan, 2016 2 commits
    • Takashi Iwai's avatar
      ALSA: usb-audio: Add quirk_alias option · e2703363
      Takashi Iwai authored
      This patch adds a new option "quirk_alias" to snd-usb-audio driver for
      allowing user to pass the quirk alias list.  A quirk alias consists of
      a string form like 0123abcd:5678beef, which makes to apply a quirk to
      a device with USB ID 0123:abcd treated as if it were 5678:beef.
      This feature is useful to test an existing quirk, typically for a
      newer model of the same vendor, without patching / rebuilding the
      kernel driver.
      The current implementation is fairly simplistic: since there is no API
      for matching a usb_device_id to the given ID pair, it has an open code
      to loop over the id table and matches only with vendor:product pair.
      So far, this is OK, as all existing entries are with vendor:product
      pairs, indeed.  Once when we have another matching entry, however,
      we'd need to update get_alias_quirk() as well.
      Note that this option is provided only for testing / development.  If
      you want to have a proper support, contact to upstream for adding the
      matching quirk in the driver code statically.
      Signed-off-by: default avatarTakashi Iwai <>
    • Takashi Iwai's avatar
      ALSA: usb-audio: Refer to chip->usb_id for quirks and MIDI creation · 79289e24
      Takashi Iwai authored
      This is a preliminary patch for the later change to allow a better
      quirk ID management.  In the current USB-audio code, there are a few
      places looking at usb_device idVendor and idProduct fields directly
      even though we have already a static member in snd_usb_audio.usb_id.
      This patch modifies such codes to refer to the latter field.
      For achieving this, two slightly intensive changes have been done:
      - The snd_usb_audio object is set/reset via dev_getdrv() for the given
        USB device; it's needed for minimizing the changes for some existing
        quirks that take only usb_device object.
      - __snd_usbmidi_create() is introduced to receive the pre-given usb_id
        argument.  The exported snd_usbmidi_create() is unchanged by calling
        this new function internally.
      Signed-off-by: default avatarTakashi Iwai <>
  35. 12 Jan, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Avoid calling usb_autopm_put_interface() at disconnect · 5c06d68b
      Takashi Iwai authored
      ALSA PCM may still have a leftover instance after disconnection and
      it delays its release.  The problem is that the PCM close code path of
      USB-audio driver has a call of snd_usb_autosuspend().  This involves
      with the call of usb_autopm_put_interface() and it may lead to a
      kernel Oops due to the NULL object like:
       BUG: unable to handle kernel NULL pointer dereference at 0000000000000190
       IP: [<ffffffff815ae7ef>] usb_autopm_put_interface+0xf/0x30 PGD 0
       Call Trace:
        [<ffffffff8173bd94>] snd_usb_autosuspend+0x14/0x20
        [<ffffffff817461bc>] snd_usb_pcm_close.isra.14+0x5c/0x90
        [<ffffffff8174621f>] snd_usb_playback_close+0xf/0x20
        [<ffffffff816ef58a>] snd_pcm_release_substream.part.36+0x3a/0x90
        [<ffffffff816ef6b3>] snd_pcm_release+0xa3/0xb0
        [<ffffffff816debb0>] snd_disconnect_release+0xd0/0xe0
        [<ffffffff8114d417>] __fput+0x97/0x1d0
        [<ffffffff8114d589>] ____fput+0x9/0x10
        [<ffffffff8109e452>] task_work_run+0x72/0x90
        [<ffffffff81088510>] do_exit+0x280/0xa80
        [<ffffffff8108996a>] do_group_exit+0x3a/0xa0
        [<ffffffff8109261f>] get_signal+0x1df/0x540
        [<ffffffff81040903>] do_signal+0x23/0x620
        [<ffffffff8114c128>] ? do_readv_writev+0x128/0x200
        [<ffffffff810012e1>] prepare_exit_to_usermode+0x91/0xd0
        [<ffffffff810013ba>] syscall_return_slowpath+0x9a/0x120
        [<ffffffff817587cd>] ? __sys_recvmsg+0x5d/0x70
        [<ffffffff810d2765>] ? ktime_get_ts64+0x45/0xe0
        [<ffffffff8115dea0>] ? SyS_poll+0x60/0xf0
        [<ffffffff818d2327>] int_ret_from_sys_call+0x25/0x8f
      We have already a check of disconnection in snd_usb_autoresume(), but
      the check is missing its counterpart.  The fix is just to put the same
      check in snd_usb_autosuspend(), too.
      Cc: <>
      Signed-off-by: default avatarTakashi Iwai <>