Skip to content
Commit 589e2272 authored by Omar Sandoval's avatar Omar Sandoval Committed by Steven Price
Browse files

iov_iter: fix advancing slot in iter_folioq_get_pages()

iter_folioq_get_pages() decides to advance to the next folioq slot when
it has reached the end of the current folio. However, it is checking
offset, which is the beginning of the current part, instead of
iov_offset, which is adjusted to the end of the current part, so it
doesn't advance the slot when it's supposed to. As a result, on the next
iteration, we'll use the same folio with an out-of-bounds offset and
return an unrelated page.

This manifested as various crashes and other failures in 9pfs in drgn's
VM testing setup and BPF CI.

Fixes: db0aa2e9 ("mm: Define struct folio_queue and ITER_FOLIOQ to handle a sequence of folios")
Link: https://lore.kernel.org/linux-fsdevel/20240923183432.1876750-1-chantr4@gmail.com/


Tested-by: default avatarManu Bretelle <chantr4@gmail.com>
Signed-off-by: default avatarOmar Sandoval <osandov@fb.com>
Link: https://lore.kernel.org/r/cbaf141ba6c0e2e209717d02746584072844841a.1727722269.git.osandov@fb.com


Tested-by: default avatarEduard Zingerman <eddyz87@gmail.com>
Tested-by: default avatarLeon Romanovsky <leon@kernel.org>
Tested-by: Joey Gouly's avatarJoey Gouly <joey.gouly@arm.com>
Acked-by: default avatarDavid Howells <dhowells@redhat.com>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
Signed-off-by: Steven Price's avatarSteven Price <steven.price@arm.com>
parent 8d727ac9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment