--- /dev/null
+
+ the check_stack_guard_page() has, under certain circumstances, side-effects which can not easily be undone in case the vx_rss_avail() fails
+
+diff --git a/mm/memory.c b/mm/memory.c
+index c53939d..158c500 100644
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -2439,13 +2439,14 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma,
+
+ pte_unmap(page_table);
+
++ if (!vx_rss_avail(mm, 1))
++ goto oom;
++
+ /* Check if we need to add a guard page to the stack */
+ if (check_stack_guard_page(vma, address) < 0)
+ return VM_FAULT_SIGBUS;
+
+ /* Allocate our own private page. */
+- if (!vx_rss_avail(mm, 1))
+- goto oom;
+ if (unlikely(anon_vma_prepare(vma)))
+ goto oom;
+ page = alloc_zeroed_user_highpage_movable(vma, address);