Repository navigation
Commit 8668c10
audio: module_adapter: cap connected buffers at MODULE_MAX_CONNECTIONS
struct processing_module holds CONFIG_MODULE_MAX_CONNECTIONS entries in
sinks[] and sources[], but the module adapter stores one entry per
connected buffer without bounding the index. On IPC4,
module_adapter_update_sinks_sources() runs from module_adapter_bind(),
and ipc4_comp_connect() connects a new buffer for every MOD_BIND, so a
ninth bind on one side of a module writes sinks[8] over sources[0] and
further binds run past the processing_module allocation. On IPC3,
module_adapter_sink_src_prepare() does the same at prepare time.
The connection count checks in module_adapter_prepare() only covered
the audio_stream path removed in a42e9b7, and the max_sources and
max_sinks fields are no longer read.
Refuse a bind in module_adapter_bind() that brings the buffers
connected on that side above CONFIG_MODULE_MAX_CONNECTIONS, and fail
module_adapter_sink_src_prepare() with -EINVAL instead of writing past
the arrays.
A refusal on the sink side goes through the e_sink_bind path of
ipc4_comp_connect(), which unbinds the source while the buffer is
still connected. The source then refreshes its sinks[] with the buffer
that is freed right after. Disconnect first, as ipc4_comp_disconnect()
does.
Signed-off-by: Shrushti P K <shrusthi@labs.digiscrypt.com>1 parent d80a052 commit 8668c10
4 files changed
Lines changed: 39 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
54 | 56 | | |
55 | 57 | | |
56 | 58 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
319 | 319 | | |
320 | 320 | | |
321 | 321 | | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
322 | 327 | | |
323 | 328 | | |
324 | 329 | | |
325 | 330 | | |
326 | 331 | | |
327 | 332 | | |
328 | 333 | | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
329 | 339 | | |
330 | 340 | | |
331 | 341 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
| 474 | + | |
| 475 | + | |
474 | 476 | | |
475 | 477 | | |
476 | 478 | | |
477 | 479 | | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
478 | 497 | | |
479 | 498 | | |
480 | 499 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1004 | 1004 | | |
1005 | 1005 | | |
1006 | 1006 | | |
1007 | | - | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
1008 | 1014 | | |
1009 | 1015 | | |
1010 | 1016 | | |
| 1017 | + | |
1011 | 1018 | | |
1012 | 1019 | | |
1013 | 1020 | | |
| |||
0 commit comments