> @@ -180,7 +186,26 @@ static void *vb2_dma_sg_get_userptr(void > *alloc_ctx, unsigned long vaddr, > if (!buf->pages) > return NULL; > > - num_pages_from_user = get_user_pages(current, current->mm, > + buf->vma = find_vma(current->mm, vaddr); > + if (!buf->vma) { > + dprintk(1, "no vma for address %lu\n", vaddr); > + return NULL; > + } > + > + if (vma_is_io(buf->vma)) { > + for (num_pages_from_user = 0; > + num_pages_from_user < buf->num_pages; > + ++num_pages_from_user, vaddr += PAGE_SIZE) { > + unsigned long pfn; > + > + if (follow_pfn(buf->vma, vaddr, &pfn)) { > + dprintk(1, "no page for address %lu\n", vaddr); > + break; > + } > + buf->pages[num_pages_from_user] = pfn_to_page(pfn); > + } > + } else > + num_pages_from_user = get_user_pages(current, current->mm, > vaddr & PAGE_MASK, > buf->num_pages, > write, Can you safely assume that your userptr will cover only one vma? At least, get_user_pages (calling __get_user_pages) does not assume that and calls find_vma() whenever vma->vm_end is reached. – Matthias CONFIDENTIALITY: The contents of this e-mail are confidential and intended only for the above addressee(s). If you are not the intended recipient, or the person responsible for delivering it to the intended recipient, copying or delivering it to anyone else or using it in any unauthorized manner is prohibited and may be unlawful. If you receive this e-mail by mistake, please notify the sender and the systems administrator at straymail@xxxxxxxxxx immediately. ��.n��������+%������w��{.n�����{��g����^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�