[PATCH 2/4] memcg: fix NULL mem_cgroup_try_charge

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



There is one way out of __mem_cgroup_try_charge() which claims success
but still leaves memcg NULL, causing oops thereafter: make sure that
it is set to root_mem_cgroup in this case.

Signed-off-by: Hugh Dickins <hughd@xxxxxxxxxx>
---
Fix to memcg: return -EINTR at bypassing try_charge()

 mm/memcontrol.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

--- mmotm.orig/mm/memcontrol.c	2011-12-28 12:53:23.420367847 -0800
+++ mmotm/mm/memcontrol.c	2011-12-28 14:41:19.803018025 -0800
@@ -2263,7 +2263,9 @@ again:
 		 * task-struct. So, mm->owner can be NULL.
 		 */
 		memcg = mem_cgroup_from_task(p);
-		if (!memcg || mem_cgroup_is_root(memcg)) {
+		if (!memcg)
+			memcg = root_mem_cgroup;
+		if (mem_cgroup_is_root(memcg)) {
 			rcu_read_unlock();
 			goto done;
 		}

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]