Skip to content

Commit ff58bbc

Browse files
committed
ALSA: usb-audio: Fix potential use-after-free of streams
With the recent full-duplex support of implicit feedback streams, an endpoint can be still running after closing the capture stream as long as the playback stream with the sync-endpoint is running. In such a state, the URBs are still be handled and they may call retire_data_urb callback, which tries to transfer the data from the PCM buffer. Since the PCM stream gets closed, this may lead to use-after-free. This patch adds the proper clearance of the callback at stopping the capture stream for addressing the possible UAF above. Fixes: 10ce77e ("ALSA: usb-audio: Add duplex sound support for USB devices using implicit feedback") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent a0b0395 commit ff58bbc

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

sound/usb/pcm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,6 +1787,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
17871787
return 0;
17881788
case SNDRV_PCM_TRIGGER_STOP:
17891789
stop_endpoints(subs);
1790+
subs->data_endpoint->retire_data_urb = NULL;
17901791
subs->running = 0;
17911792
return 0;
17921793
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:

0 commit comments

Comments
 (0)