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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx>

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



[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux