[pulseaudio-discuss] [PATCH v0 2/3] bluetooth: Fix potential assertion failure if MTU changes

Mikel Astiz mikel.astiz.oss at gmail.com
Thu Jan 24 01:16:56 PST 2013


From: Mikel Astiz <mikel.astiz at bmw-carit.de>

The assertion in hsp_process_render() assumes that, if a memory block is
already set by the time the function is reached, its size matches
write_block_size.

This can however fail if a transport has been released and acquired
back, in the unlikely case where the MTU has changed in the meantime,
assuming the memory block wasn't released.
---
 src/modules/bluetooth/module-bluetooth-device.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
index 8d9c124..c153949 100644
--- a/src/modules/bluetooth/module-bluetooth-device.c
+++ b/src/modules/bluetooth/module-bluetooth-device.c
@@ -332,6 +332,11 @@ static void teardown_stream(struct userdata *u) {
         u->read_smoother = NULL;
     }
 
+    if (u->write_memchunk.memblock) {
+        pa_memblock_unref(u->write_memchunk.memblock);
+        pa_memchunk_reset(&u->write_memchunk);
+    }
+
     pa_log_debug("Audio stream torn down");
 }
 
-- 
1.7.11.7



More information about the pulseaudio-discuss mailing list