Commit 211ff16
ublk: verify all pages in multi-page bvec fall within registered range
rq_for_each_bvec() yields multi-page bvecs where bv_page is only the
first page. ublk_try_buf_match() only validated the start PFN against
the maple tree, but a bvec can span multiple pages past the end of a
registered range.
Use mas_walk() instead of mtree_load() to obtain the range boundaries
stored in the maple tree, and check that the bvec's end PFN does not
exceed the range. Also remove base_pfn from struct ublk_buf_range
since mas.index already provides the range start PFN.
Reported-by: Caleb Sander Mateos <csander@purestorage.com>
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
Link: https://patch.msgid.link/20260409133020.3780098-3-tom.leiming@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 23b3b6f commit 211ff16
1 file changed
Lines changed: 11 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
304 | 304 | | |
305 | 305 | | |
306 | 306 | | |
307 | | - | |
308 | 307 | | |
309 | 308 | | |
310 | 309 | | |
| |||
5306 | 5305 | | |
5307 | 5306 | | |
5308 | 5307 | | |
5309 | | - | |
5310 | 5308 | | |
5311 | 5309 | | |
5312 | 5310 | | |
| |||
5451 | 5449 | | |
5452 | 5450 | | |
5453 | 5451 | | |
5454 | | - | |
5455 | | - | |
| 5452 | + | |
| 5453 | + | |
5456 | 5454 | | |
5457 | 5455 | | |
5458 | 5456 | | |
| |||
5531 | 5529 | | |
5532 | 5530 | | |
5533 | 5531 | | |
| 5532 | + | |
| 5533 | + | |
5534 | 5534 | | |
5535 | 5535 | | |
| 5536 | + | |
5536 | 5537 | | |
5537 | | - | |
| 5538 | + | |
5538 | 5539 | | |
5539 | 5540 | | |
5540 | 5541 | | |
| 5542 | + | |
| 5543 | + | |
| 5544 | + | |
| 5545 | + | |
5541 | 5546 | | |
5542 | | - | |
| 5547 | + | |
5543 | 5548 | | |
5544 | 5549 | | |
5545 | 5550 | | |
| |||
0 commit comments