Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2a324fcd authored by Takashi Iwai's avatar Takashi Iwai
Browse files

ALSA: line6: Abort if inconsistent usbdev is found at disconnect



It's utterly unsafe to proceed further the disconnect procedure if the
assigned usbdev is inconsistent with the expected object.  Better to
put a WARN_ON() for more cautions and abort immediately.

Tested-by: default avatarChris Rorvick <chris@rorvick.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 270fd9c7
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -585,12 +585,12 @@ void line6_disconnect(struct usb_interface *interface)
	if (!line6)
	if (!line6)
		return;
		return;


	if (WARN_ON(usbdev != line6->usbdev))
		return;

	if (line6->urb_listen != NULL)
	if (line6->urb_listen != NULL)
		line6_stop_listen(line6);
		line6_stop_listen(line6);


	if (usbdev != line6->usbdev)
		dev_err(line6->ifcdev, "driver bug: inconsistent usb device\n");

	snd_card_disconnect(line6->card);
	snd_card_disconnect(line6->card);
	if (line6->line6pcm)
	if (line6->line6pcm)
		line6_pcm_disconnect(line6->line6pcm);
		line6_pcm_disconnect(line6->line6pcm);