summaryrefslogtreecommitdiffstats
path: root/io_uring/rsrc.c
diff options
context:
space:
mode:
Diffstat (limited to 'io_uring/rsrc.c')
-rw-r--r--io_uring/rsrc.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/io_uring/rsrc.c b/io_uring/rsrc.c
index 20dcc7668cb0..ddee7adb4006 100644
--- a/io_uring/rsrc.c
+++ b/io_uring/rsrc.c
@@ -1053,17 +1053,14 @@ struct page **io_pin_pages(unsigned long ubuf, unsigned long len, int *npages)
pret = pin_user_pages(ubuf, nr_pages, FOLL_WRITE | FOLL_LONGTERM,
pages, vmas);
if (pret == nr_pages) {
- struct file *file = vmas[0]->vm_file;
-
/* don't support file backed memory */
for (i = 0; i < nr_pages; i++) {
- if (vmas[i]->vm_file != file) {
- ret = -EINVAL;
- break;
- }
- if (!file)
+ struct vm_area_struct *vma = vmas[i];
+
+ if (vma_is_shmem(vma))
continue;
- if (!vma_is_shmem(vmas[i]) && !is_file_hugepages(file)) {
+ if (vma->vm_file &&
+ !is_file_hugepages(vma->vm_file)) {
ret = -EOPNOTSUPP;
break;
}