mm/hmm: add missing call to hmm_range_need_fault() before returning EFAULT
authorJason Gunthorpe <jgg@mellanox.com>
Thu, 5 Mar 2020 16:00:22 +0000 (12:00 -0400)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 26 Mar 2020 17:33:37 +0000 (14:33 -0300)
commitc2579c9c4add3110b2ce81198f8a6bbb5055cfda
tree350e26c58812106943e104caa413004f61a9a977
parent7d082987e5e562c07a208503a607a733d50553ba
mm/hmm: add missing call to hmm_range_need_fault() before returning EFAULT

All return paths that do EFAULT must call hmm_range_need_fault() to
determine if the user requires this page to be valid.

If the page cannot be made valid if the user later requires it, due to vma
flags in this case, then the return should be HMM_PFN_ERROR.

Fixes: a3e0d41c2b1f ("mm/hmm: improve driver API to work and wait over a range")
Reviewed-by: Ralph Campbell <rcampbell@nvidia.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
mm/hmm.c