On Thu, Apr 23, 2020 at 10:24:19AM -0500, Janakarajan Natarajan wrote: > When trying to lock read-only pages, sev_pin_memory() fails because FOLL_WRITE > is used as the flag for get_user_pages_fast(). > > Commit 73b0140bf0fe ("mm/gup: change GUP fast to use flags rather than a write > 'bool'") updated the get_user_pages_fast() call sites to use flags, but > incorrectly updated the call in sev_pin_memory(). As the original coding of this > call was correct, revert the change made by that commit. > > Fixes: 73b0140bf0fe ("mm/gup: change GUP fast to use flags rather than a write 'bool'") > Signed-off-by: Janakarajan Natarajan <Janakarajan.Natarajan@xxxxxxx> Reviewed-by: Ira Weiny <ira.weiny@xxxxxxxxx> > --- > arch/x86/kvm/svm/sev.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/x86/kvm/svm/sev.c b/arch/x86/kvm/svm/sev.c > index cf912b4aaba8..89f7f3aebd31 100644 > --- a/arch/x86/kvm/svm/sev.c > +++ b/arch/x86/kvm/svm/sev.c > @@ -345,7 +345,7 @@ static struct page **sev_pin_memory(struct kvm *kvm, unsigned long uaddr, > return NULL; > > /* Pin the user virtual address. */ > - npinned = get_user_pages_fast(uaddr, npages, FOLL_WRITE, pages); > + npinned = get_user_pages_fast(uaddr, npages, write ? FOLL_WRITE : 0, pages); > if (npinned != npages) { > pr_err("SEV: Failure locking %lu pages.\n", npages); > goto err; > -- > 2.17.1 >