mm: fix pageref leak in do_swap_page()
authorJohannes Weiner <hannes@cmpxchg.org>
Thu, 30 Apr 2009 22:08:08 +0000 (15:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 2 May 2009 22:36:09 +0000 (15:36 -0700)
commitbc43f75cd9815833b27831600ccade672edb5e43
tree87ded2ff291b63259ac3df846a09d8348174f636
parent53951bd57dfe2da58f86cdf276719082d80d8485
mm: fix pageref leak in do_swap_page()

By the time the memory cgroup code is notified about a swapin we
already hold a reference on the fault page.

If the cgroup callback fails make sure to unlock AND release the page
reference which was taken by lookup_swap_cach(), or we leak the reference.

Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Balbir Singh <balbir@linux.vnet.ibm.com>
Reviewed-by: Minchan Kim <minchan.kim@gmail.com>
Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory.c