diff options
author | Pavel Skripkin <paskripkin@gmail.com> | 2021-03-09 01:30:57 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-03-17 19:06:27 +0300 |
commit | 29bc89c8b48dd1bfd7b1f55143b5d75d599e2a12 (patch) | |
tree | 78d4021604fb30b763ff7a0fbf7cc5a2c5e75ef5 /sound/usb | |
parent | d2fdcc82d8661d8d29002e628f9d281f056942e7 (diff) | |
download | linux-29bc89c8b48dd1bfd7b1f55143b5d75d599e2a12.tar.xz |
ALSA: usb-audio: fix use after free in usb_audio_disconnect
commit c5aa956eaeb05fe87e33433d7fd9f5e4d23c7416 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: 9799110825db ("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>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/card.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c index 478bcbff53d0..fc7c359ae215 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -907,6 +907,9 @@ static void usb_audio_disconnect(struct usb_interface *intf) } } + if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND) + usb_enable_autosuspend(interface_to_usbdev(intf)); + chip->num_interfaces--; if (chip->num_interfaces <= 0) { usb_chip[chip->index] = NULL; @@ -915,9 +918,6 @@ static void usb_audio_disconnect(struct usb_interface *intf) } else { mutex_unlock(®ister_mutex); } - - if (chip->quirk_type & QUIRK_SETUP_DISABLE_AUTOSUSPEND) - usb_enable_autosuspend(interface_to_usbdev(intf)); } /* lock the shutdown (disconnect) task and autoresume */ |