Commit 5c19daa
Bluetooth: MGMT: fix crash in set_mesh_sync and set_mesh_complete
commit e878540 upstream.
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 <[email protected]>
Reviewed-by: Paul Menzel <[email protected]>
Signed-off-by: Luiz Augusto von Dentz <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>1 parent 01c7a6e commit 5c19daa
2 files changed
+16
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
847 | 847 | | |
848 | 848 | | |
849 | 849 | | |
850 | | - | |
| 850 | + | |
851 | 851 | | |
852 | 852 | | |
853 | 853 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2170 | 2170 | | |
2171 | 2171 | | |
2172 | 2172 | | |
| 2173 | + | |
| 2174 | + | |
2173 | 2175 | | |
2174 | 2176 | | |
2175 | | - | |
| 2177 | + | |
2176 | 2178 | | |
2177 | 2179 | | |
2178 | | - | |
2179 | 2180 | | |
| 2181 | + | |
| 2182 | + | |
| 2183 | + | |
2180 | 2184 | | |
2181 | 2185 | | |
2182 | 2186 | | |
2183 | 2187 | | |
2184 | 2188 | | |
2185 | | - | |
| 2189 | + | |
| 2190 | + | |
2186 | 2191 | | |
2187 | 2192 | | |
2188 | 2193 | | |
| |||
2192 | 2197 | | |
2193 | 2198 | | |
2194 | 2199 | | |
2195 | | - | |
| 2200 | + | |
| 2201 | + | |
2196 | 2202 | | |
2197 | 2203 | | |
2198 | 2204 | | |
2199 | | - | |
2200 | | - | |
2201 | 2205 | | |
2202 | 2206 | | |
2203 | | - | |
| 2207 | + | |
2204 | 2208 | | |
2205 | 2209 | | |
2206 | 2210 | | |
2207 | 2211 | | |
2208 | | - | |
2209 | | - | |
| 2212 | + | |
| 2213 | + | |
2210 | 2214 | | |
2211 | | - | |
| 2215 | + | |
2212 | 2216 | | |
2213 | 2217 | | |
2214 | 2218 | | |
2215 | | - | |
| 2219 | + | |
2216 | 2220 | | |
2217 | 2221 | | |
2218 | 2222 | | |
| |||
0 commit comments