Commit 0f097f0
lib/scatterlist: Fix to calculate the last_pg properly
The last_pg is wrong, it is actually the first page of the last
scatterlist element. To get the last page of the last scatterlist element
we have to add prv->length. So it is checking mergability against the
wrong page, Further, a SG element is not guaranteed to end on a page
boundary, so we have to check the sub page location also for merge
eligibility.
Fix the above by checking physical contiguity based on PFNs, compute the
actual last page and then call pages_are_mergable().
Fixes: 1567b49 ("lib/scatterlist: add check when merging zone device pages")
Link: https://lore.kernel.org/r/[email protected]
Reported-by: Jason Gunthorpe <[email protected]>
Signed-off-by: Yishai Hadas <[email protected]>
Reviewed-by: Chaitanya Kulkarni <[email protected]>
Signed-off-by: Jason Gunthorpe <[email protected]>1 parent b3deec2 commit 0f097f0
1 file changed
+15
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
470 | 470 | | |
471 | 471 | | |
472 | 472 | | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
473 | 476 | | |
474 | 477 | | |
475 | 478 | | |
476 | 479 | | |
477 | 480 | | |
478 | | - | |
479 | | - | |
480 | | - | |
481 | | - | |
482 | | - | |
483 | | - | |
484 | | - | |
485 | | - | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
486 | 493 | | |
487 | | - | |
488 | | - | |
489 | 494 | | |
490 | 495 | | |
491 | 496 | | |
| |||
0 commit comments