Skip to contentSkip to conversation

fork, memcg: fix cached_stacks case

PATCH New [email protected] 1 participant 1 message Jan 8, 2019

Subsystems (4)
lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 2/14 fork, memcg: fix cached_stacks case

From: Shakeel Butt <[email protected]>
Subject: fork, memcg: fix cached_stacks case

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")
Cc Rik van Riel <[email protected]>
Cc Roman Gushchin <[email protected]>
Cc Johannes Weiner <[email protected]>
Cc Tejun Heo <[email protected]>

---

 kernel/fork.c |    1 +
 1 file changed, 1 insertion(+)
kernel/fork.c renamed from kernel/fork.c~fork-memcg-fix-cached_stacks-case +1 -0
@@ -217,6 +217,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;
 	}
 

_