Re: [syzbot] [mm?] WARNING in try_grab_page
From: David Howells
Date: Wed Jul 26 2023 - 04:37:41 EST
Sven Schnelle <svens@xxxxxxxxxxxxx> wrote:
> However, hash_sendmsg() also unpins via af_alg_free_sg() in the error
> path. From an API perspective, i would prefer if extract_user_to_sg()
> does the unpinning on error. Any thoughts?
In the event of an error, extract_user_to_sg() unpins only the pages it added
to the scatterlist; it doesn't unpin any pages that were already there and
doesn't free the scatterlist; it also decrements sgtable->nents so that the
caller doesn't see the pages it attempted to add, so calling af_alg_free_sg()
shouldn't hurt.
Note that the error path also frees the result, so we do need to do at least
part of it.
David