mm/hmm: don't handle the non-fault case in hmm_vma_walk_hole_()
authorChristoph Hellwig <hch@lst.de>
Mon, 16 Mar 2020 13:53:09 +0000 (14:53 +0100)
committerJason Gunthorpe <jgg@mellanox.com>
Thu, 26 Mar 2020 17:33:37 +0000 (14:33 -0300)
commitf8c888a304e12074d941428b4aa1b13f04dd54ee
tree6dfac480663f9f33acf2aac80311d68b98d224d1
parent45050692dec83a67c0325535aae984f56560e3a9
mm/hmm: don't handle the non-fault case in hmm_vma_walk_hole_()

Setting a pfns entry to NONE before returning -EBUSY is a bug that will
cause corruption of the input flags on the next loop.

There is just a single caller using hmm_vma_walk_hole_() for the non-fault
case.  Use hmm_pfns_fill() to fill the whole pfn array with zeroes in the
only caller for the non-fault case and remove the non-fault path from
hmm_vma_walk_hole_(). This avoids setting NONE before returning -EBUSY.

Also rename the function to hmm_vma_fault() to better describe what it
does.

Fixes: 2aee09d8c116 ("mm/hmm: change hmm_vma_fault() to allow write fault on page basis")
Link: https://lore.kernel.org/r/20200316135310.899364-5-hch@lst.de
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Jason Gunthorpe <jgg@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
mm/hmm.c