[LTP] [PATCH] mm/vma: Return the exact errno for __split_vma() and mas_store_gfp()
Xiao Yang
ice_yangxiao@163.com
Mon Sep 9 07:02:26 CEST 2024
__split_vma() and mas_store_gfp() returns several types of errno on
failure so don't ignore them in vms_gather_munmap_vmas(). For example,
__split_vma() returns -EINVAL when an unaligned huge page is unmapped.
This issue is reproduced by ltp memfd_create03 test.
Fixes: 6898c9039bc8 ("mm/vma: extract the gathering of vmas from do_vmi_align_munmap()")
Signed-off-by: Xiao Yang <ice_yangxiao@163.com>
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202409081536.d283a0fb-oliver.sang@intel.com
---
mm/vma.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/mm/vma.c b/mm/vma.c
index 8d1686fc8d5a..3feeea9a8c3d 100644
--- a/mm/vma.c
+++ b/mm/vma.c
@@ -1200,7 +1200,8 @@ int vms_gather_munmap_vmas(struct vma_munmap_struct *vms,
goto start_split_failed;
}
- if (__split_vma(vms->vmi, vms->vma, vms->start, 1))
+ error = __split_vma(vms->vmi, vms->vma, vms->start, 1);
+ if (error)
goto start_split_failed;
}
vms->prev = vma_prev(vms->vmi);
@@ -1220,12 +1221,14 @@ int vms_gather_munmap_vmas(struct vma_munmap_struct *vms,
}
/* Does it split the end? */
if (next->vm_end > vms->end) {
- if (__split_vma(vms->vmi, next, vms->end, 0))
+ error = __split_vma(vms->vmi, next, vms->end, 0);
+ if (error)
goto end_split_failed;
}
vma_start_write(next);
mas_set(mas_detach, vms->vma_count++);
- if (mas_store_gfp(mas_detach, next, GFP_KERNEL))
+ error = mas_store_gfp(mas_detach, next, GFP_KERNEL);
+ if (error)
goto munmap_gather_failed;
vma_mark_detached(next, true);
--
2.46.0
More information about the ltp
mailing list