4.20-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Shakeel Butt <shake...@google.com>

commit ba4a45746c362b665e245c50b870615f02f34781 upstream.

Commit 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on
memcg charge fail") fixes a crash caused due to failed memcg charge of
the kernel stack.  However the fix misses the cached_stacks case which
this patch fixes.  So, the same crash can happen if the memcg charge of
a cached stack is failed.

Link: http://lkml.kernel.org/r/20190102180145.57406-1-shake...@google.com
Fixes: 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on memcg 
charge fail")
Signed-off-by: Shakeel Butt <shake...@google.com>
Acked-by: Michal Hocko <mho...@suse.com>
Acked-by: Rik van Riel <r...@surriel.com>
Cc: Rik van Riel <r...@surriel.com>
Cc: Roman Gushchin <g...@fb.com>
Cc: Johannes Weiner <han...@cmpxchg.org>
Cc: Tejun Heo <t...@kernel.org>
Cc: <sta...@vger.kernel.org>
Signed-off-by: Andrew Morton <a...@linux-foundation.org>
Signed-off-by: Linus Torvalds <torva...@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gre...@linuxfoundation.org>

---
 kernel/fork.c |    1 +
 1 file changed, 1 insertion(+)

--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -221,6 +221,7 @@ static unsigned long *alloc_thread_stack
                memset(s->addr, 0, THREAD_SIZE);
 
                tsk->stack_vm_area = s;
+               tsk->stack = s->addr;
                return s->addr;
        }
 


Reply via email to