[lkml]   [2019]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 4.20 27/57] fork, memcg: fix cached_stacks case
4.20-stable review patch.  If anyone has any objections, please let me know.


From: Shakeel Butt <>

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.

Fixes: 5eed6f1dff87 ("fork,memcg: fix crash in free_thread_stack on memcg charge fail")
Signed-off-by: Shakeel Butt <>
Acked-by: Michal Hocko <>
Acked-by: Rik van Riel <>
Cc: Rik van Riel <>
Cc: Roman Gushchin <>
Cc: Johannes Weiner <>
Cc: Tejun Heo <>
Cc: <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: Greg Kroah-Hartman <>

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;

 \ /
  Last update: 2019-01-15 17:44    [W:0.176 / U:10.068 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site