Commit 9f9967f
soc: qcom: mdt_loader: Ensure we don't read past the ELF header
When the MDT loader is used in remoteproc, the ELF header is sanitized
beforehand, but that's not necessary the case for other clients.
Validate the size of the firmware buffer to ensure that we don't read
past the end as we iterate over the header. e_phentsize and e_shentsize
are validated as well, to ensure that the assumptions about step size in
the traversal are valid.
Fixes: 2aad40d ("remoteproc: Move qcom_mdt_loader into drivers/soc/qcom")
Cc: stable@vger.kernel.org
Reported-by: Doug Anderson <dianders@chromium.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@oss.qualcomm.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Link: https://lore.kernel.org/r/20250610-mdt-loader-validation-and-fixes-v2-1-f7073e9ab899@oss.qualcomm.com
Signed-off-by: Bjorn Andersson <andersson@kernel.org>1 parent 19272b3 commit 9f9967f
1 file changed
+43
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
21 | 52 | | |
22 | 53 | | |
23 | 54 | | |
| |||
82 | 113 | | |
83 | 114 | | |
84 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
85 | 119 | | |
86 | 120 | | |
87 | 121 | | |
| |||
134 | 168 | | |
135 | 169 | | |
136 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
137 | 174 | | |
138 | 175 | | |
139 | 176 | | |
| |||
214 | 251 | | |
215 | 252 | | |
216 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
217 | 257 | | |
218 | 258 | | |
219 | 259 | | |
| |||
310 | 350 | | |
311 | 351 | | |
312 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
313 | 356 | | |
314 | 357 | | |
315 | 358 | | |
| |||
0 commit comments