Commit 27109ca
ovl: fix use after free in struct ovl_aio_req
jira VULN-6260
cve CVE-2023-1252
commit-author yangerkun <[email protected]>
commit 9a25440
Example for triggering use after free in a overlay on ext4 setup:
aio_read
ovl_read_iter
vfs_iter_read
ext4_file_read_iter
ext4_dio_read_iter
iomap_dio_rw -> -EIOCBQUEUED
/*
* Here IO is completed in a separate thread,
* ovl_aio_cleanup_handler() frees aio_req which has iocb embedded
*/
file_accessed(iocb->ki_filp); /**BOOM**/
Fix by introducing a refcount in ovl_aio_req similarly to aio_kiocb. This
guarantees that iocb is only freed after vfs_read/write_iter() returns on
underlying fs.
Fixes: 2406a30 ("ovl: implement async IO routines")
Signed-off-by: yangerkun <[email protected]>
Link: https://lore.kernel.org/r/[email protected]/
Cc: <[email protected]> # v5.6
Signed-off-by: Miklos Szeredi <[email protected]>
(cherry picked from commit 9a25440)
Signed-off-by: Marcin Wcisło <[email protected]>1 parent e6355f7 commit 27109ca
1 file changed
+14
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
252 | 253 | | |
253 | 254 | | |
254 | 255 | | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
255 | 264 | | |
256 | 265 | | |
257 | 266 | | |
| |||
268 | 277 | | |
269 | 278 | | |
270 | 279 | | |
271 | | - | |
272 | | - | |
| 280 | + | |
273 | 281 | | |
274 | 282 | | |
275 | 283 | | |
| |||
313 | 321 | | |
314 | 322 | | |
315 | 323 | | |
| 324 | + | |
316 | 325 | | |
| 326 | + | |
317 | 327 | | |
318 | 328 | | |
319 | 329 | | |
| |||
378 | 388 | | |
379 | 389 | | |
380 | 390 | | |
| 391 | + | |
381 | 392 | | |
| 393 | + | |
382 | 394 | | |
383 | 395 | | |
384 | 396 | | |
| |||
0 commit comments