Skip to contentSkip to conversation

mm-mprotect-fix-do_mprotect_pkey-return-on-error.patch removed from -mm tree

merged mm-hotfixes-stable Andrew Morton 1 participant 1 message Apr 16, 2023 Stable branch

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: mm/mprotect: fix do_mprotect_pkey() return on error
has been removed from the -mm tree. Its filename was
mm-mprotect-fix-do_mprotect_pkey-return-on-error.patch

This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: "Liam R. Howlett" <[email protected]>
Subject: mm/mprotect: fix do_mprotect_pkey() return on error
Date: Thu, 6 Apr 2023 15:30:50 -0400

When the loop over the VMA is terminated early due to an error, the return code could be overwritten with ENOMEM. Fix the return code by only setting the error on early loop termination when the error is not set.

User-visible effects include: attempts to run mprotect() against a special mapping or with a poorly-aligned hugetlb address should return -EINVAL, but they presently return -ENOMEM. In other cases an -EACCESS should be returned.

Fixes 2286a6914c77 ("mm: change mprotect_fixup to vma iterator")

---

 mm/mprotect.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/mprotect.c renamed from mm/mprotect.c~mm-mprotect-fix-do_mprotect_pkey-return-on-error +1 -1
@@ -838,7 +838,7 @@ static int do_mprotect_pkey(unsigned lon
 	}
 	tlb_finish_mmu(&tlb);
 
-	if (vma_iter_end(&vmi) < end)
+	if (!error && vma_iter_end(&vmi) < end)
 		error = -ENOMEM;
 
 out:

_

Patches currently in -mm which might be from [email protected] are

maple_tree-make-maple-state-reusable-after-mas_empty_area_rev.patch maple_tree-fix-mas_empty_area-search.patch mm-mmap-regression-fix-for-unmapped_area_topdown.patch