[lvc-project] [PATCH] lib: free pagelist on error in iov_iter_extract_pages()

Dmitry Antipov dmantipov at yandex.ru
Tue May 12 14:23:38 MSK 2026


On Fri, 2026-05-08 at 11:33 -0700, Caleb Sander Mateos wrote:

> Callers seem to be inconsistent about whether they treat ret < 0
> or ret <= 0 as the error case, which is another argument not to
> handle freeing the pages array inside iov_iter_extract_pages().

Hmm... looking through iov_iter_extract_pages() innards, ret == 0 means something like
"no error but no data for further processing". Using iov_iter_extract_user_pages()
as an example, iov_iter_advance() is not called if pin_user_pages_fast() returns 0
and, since the pages array won't be touched anymore, it may be freed safely.

Dmitry



More information about the lvc-project mailing list