Commit 11200e5
audio: copier: bound ALH mapping count to the gateway config size
copier_alh_assign_dai_index() reads alh_cfg.count from the host-supplied
gateway config blob and walks alh_cfg.mapping[0..count). Count was only
bounded by the mapping[] array size, not the actual blob size, so a malformed
blob could make the mapping walk read past config_data and underflow
dma_config_length in the HDA branch.
Validate that the blob contains the fixed header before reading count, then
ensure count is within the mapping[] bound and that its computed ALH
configuration size fits in the blob. This rejects malformed configurations
before any mapping[] access.
HDA always reads mapping[0], including for a single gateway. Reject a zero
count in this path so a header-only blob cannot cause that out-of-bounds read.
Keep zero-count behavior unchanged for single ALH, which does not access
mapping[]. Use %zu when logging blob_size to preserve size_t values on
64-bit builds.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>1 parent ab4d585 commit 11200e5
1 file changed
Lines changed: 19 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
| 80 | + | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
86 | 87 | | |
87 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
88 | 104 | | |
89 | 105 | | |
90 | 106 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
| 107 | + | |
97 | 108 | | |
98 | | - | |
| 109 | + | |
99 | 110 | | |
100 | 111 | | |
101 | | - | |
102 | 112 | | |
103 | 113 | | |
104 | 114 | | |
| |||
0 commit comments