Skip to content

Commit dafb28f

Browse files
committed
ALSA: usx2y: Use snd_card_free_when_closed() at disconnection
The USB disconnect callback is supposed to be short and not too-long waiting. OTOH, the current code uses snd_card_free() at disconnection, but this waits for the close of all used fds, hence it can take long. It eventually blocks the upper layer USB ioctls, which may trigger a soft lockup. An easy workaround is to replace snd_card_free() with snd_card_free_when_closed(). This variant returns immediately while the release of resources is done asynchronously by the card device release at the last close. Fixes: 230cd5e ("[ALSA] prevent oops & dead keyboard on usb unplugging while the device is be ing used") Reported-by: syzbot+73582d08864d8268b6fd@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=73582d08864d8268b6fd Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20241113111042.15058-2-tiwai@suse.de
1 parent f69c286 commit dafb28f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sound/usb/usx2y/usbusx2y.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ static void snd_usx2y_disconnect(struct usb_interface *intf)
422422
}
423423
if (usx2y->us428ctls_sharedmem)
424424
wake_up(&usx2y->us428ctls_wait_queue_head);
425-
snd_card_free(card);
425+
snd_card_free_when_closed(card);
426426
}
427427

428428
static int snd_usx2y_probe(struct usb_interface *intf,

0 commit comments

Comments
 (0)