]> git.karo-electronics.de Git - karo-tx-linux.git/commit
memcg: fix wrong VM_BUG_ON() in try_charge()'s mm->owner check
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Wed, 29 Dec 2010 22:07:11 +0000 (14:07 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 7 Jan 2011 21:58:45 +0000 (13:58 -0800)
commite606509bc1d7f19fccf078907d5421b3a95bd659
treea080a8d36ddc1682a1f521a14d06b7bfc57f28fb
parentb16e490eb5f7fb19f1e8fd07f6d45d771a487f82
memcg: fix wrong VM_BUG_ON() in try_charge()'s mm->owner check

commit ebb76ce16daf6908dc030dec1c00827d37129fe5 upstream.

At __mem_cgroup_try_charge(), VM_BUG_ON(!mm->owner) is checked.
But as commented in mem_cgroup_from_task(), mm->owner can be NULL
in some racy case. This check of VM_BUG_ON() is bad.

A possible story to hit this is at swapoff()->try_to_unuse(). It passes
mm_struct to mem_cgroup_try_charge_swapin() while mm->owner is NULL. If we
can't get proper mem_cgroup from swap_cgroup information, mm->owner is used
as charge target and we see NULL.

Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Reported-by: Hugh Dickins <hughd@google.com>
Reported-by: Thomas Meyer <thomas@m3y3r.de>
Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Reviewed-by: Balbir Singh <balbir@linux.vnet.ibm.com>
Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
mm/memcontrol.c