From: Leon Romanovsky <leon…@nvidia.com> If the first control-interface probe fails after claiming streaming or MIDI interfaces, freeing the card leaves those claims behind. Module unload can then race with registration of the claimed interfaces and leave dangling driver pointers. Release auxiliary claims when discarding a newly created card. Preserve them when a failed secondary probe leaves an existing card in use. Fixes: 9ad3d6ccf5ee ("[PATCH] USB: Remove USB private semaphore") Reviewed-by: Takashi Iwai <tiw…@suse.de> Signed-off-by: Leon Romanovsky <leon…@nvidia.com> --- sound/usb/card.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sound/usb/card.c b/sound/usb/card.c index 59979b793fe9..56ebdd61f72e 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -1090,6 +1090,13 @@ static int usb_audio_probe(struct usb_interface *intf, atomic_dec(&chip->active); if (!chip->num_interfaces) { usb_audio_disconnect_components(chip); + for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { + struct usb_interface *iface = dev->actconfig->interface[i]; + + if (iface->dev.driver == &usb_audio_driver.driver && + usb_get_intfdata(iface) == USB_AUDIO_IFACE_UNUSED) + usb_driver_release_interface(&usb_audio_driver, iface); + } snd_card_free(chip->card); } }
-- 2.56.1