]> git.baikalelectronics.ru Git - kernel.git/commit
ALSA: usb-audio: Fix potential use-after-free of streams
authorTakashi Iwai <tiwai@suse.de>
Tue, 16 Jun 2020 12:09:21 +0000 (14:09 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 17 Jun 2020 08:08:12 +0000 (10:08 +0200)
commit1a84de41a62a99289d0b765862462f124b0f854b
tree6c7a236d00a9dff28e3d78123bf40b6c2c73e302
parent115ff66c89f29afea034690fa583dad3a57f6474
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: 231087219629 ("ALSA: usb-audio: Add duplex sound support for USB devices using implicit feedback")
Link: https://lore.kernel.org/r/20200616120921.12249-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/pcm.c