Skip to content

Commit 29bc89c

Browse files
pskrgaggregkh
authored andcommitted
ALSA: usb-audio: fix use after free in usb_audio_disconnect
commit c5aa956 upstream. The problem was in wrong "if" placement. chip->quirk_type is freed in snd_card_free_when_closed(), but inside if statement it's accesed. Fixes: 9799110 ("ALSA: usb-audio: Disable USB autosuspend properly in setup_disable_autosuspend()") Signed-off-by: Pavel Skripkin <paskripkin@gmail.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/16da19126ff461e5e64a9aec648cce28fb8ed73e.1615242183.git.paskripkin@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d2fdcc8 commit 29bc89c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

‎sound/usb/card.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,9 @@ static void usb_audio_disconnect(struct usb_interface *intf)
907907
}
908908
}
909909

910+
if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND)
911+
usb_enable_autosuspend(interface_to_usbdev(intf));
912+
910913
chip->num_interfaces--;
911914
if (chip->num_interfaces <= 0) {
912915
usb_chip[chip->index] = NULL;
@@ -915,9 +918,6 @@ static void usb_audio_disconnect(struct usb_interface *intf)
915918
} else {
916919
mutex_unlock(&register_mutex);
917920
}
918-
919-
if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND)
920-
usb_enable_autosuspend(interface_to_usbdev(intf));
921921
}
922922

923923
/* lock the shutdown (disconnect) task and autoresume */

0 commit comments

Comments
 (0)