Commit e878540
Bluetooth: MGMT: fix crash in set_mesh_sync and set_mesh_complete
There is a BUG: KASAN: stack-out-of-bounds in set_mesh_sync due to
memcpy from badly declared on-stack flexible array.
Another crash is in set_mesh_complete() due to double list_del via
mgmt_pending_valid + mgmt_pending_remove.
Use DEFINE_FLEX to declare the flexible array right, and don't memcpy
outside bounds.
As mgmt_pending_valid removes the cmd from list, use mgmt_pending_free,
and also report status on error.
Fixes: 302a1f6 ("Bluetooth: MGMT: Fix possible UAFs")
Signed-off-by: Pauli Virtanen <pav@iki.fi>
Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>1 parent 0d92808 commit e878540
2 files changed
Lines changed: 16 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
853 | 853 | | |
854 | 854 | | |
855 | 855 | | |
856 | | - | |
| 856 | + | |
857 | 857 | | |
858 | 858 | | |
859 | 859 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2175 | 2175 | | |
2176 | 2176 | | |
2177 | 2177 | | |
| 2178 | + | |
| 2179 | + | |
2178 | 2180 | | |
2179 | 2181 | | |
2180 | | - | |
| 2182 | + | |
2181 | 2183 | | |
2182 | 2184 | | |
2183 | | - | |
2184 | 2185 | | |
| 2186 | + | |
| 2187 | + | |
| 2188 | + | |
2185 | 2189 | | |
2186 | 2190 | | |
2187 | 2191 | | |
2188 | 2192 | | |
2189 | 2193 | | |
2190 | | - | |
| 2194 | + | |
| 2195 | + | |
2191 | 2196 | | |
2192 | 2197 | | |
2193 | 2198 | | |
| |||
2197 | 2202 | | |
2198 | 2203 | | |
2199 | 2204 | | |
2200 | | - | |
| 2205 | + | |
| 2206 | + | |
2201 | 2207 | | |
2202 | 2208 | | |
2203 | 2209 | | |
2204 | | - | |
2205 | | - | |
2206 | 2210 | | |
2207 | 2211 | | |
2208 | | - | |
| 2212 | + | |
2209 | 2213 | | |
2210 | 2214 | | |
2211 | 2215 | | |
2212 | 2216 | | |
2213 | | - | |
2214 | | - | |
| 2217 | + | |
| 2218 | + | |
2215 | 2219 | | |
2216 | | - | |
| 2220 | + | |
2217 | 2221 | | |
2218 | 2222 | | |
2219 | 2223 | | |
2220 | | - | |
| 2224 | + | |
2221 | 2225 | | |
2222 | 2226 | | |
2223 | 2227 | | |
| |||
0 commit comments