mm: don't call pte_unmap() against an improper pte
authorDaisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Mon, 26 Oct 2009 23:50:23 +0000 (16:50 -0700)
committerMatt Sealey <matt@genesi-usa.com>
Sat, 28 Aug 2010 20:40:16 +0000 (15:40 -0500)
commit0de368739eecfe1d2b05e989b31e75fb1af138a7
treecf284b2ae4a97210bb704c03bcf2020f9834ace5
parent1cb5bb4cb224279b526572fa4143f7972bd159e6
mm: don't call pte_unmap() against an improper pte

There are some places where we do like:

pte = pte_map();
do {
(do break in some conditions)
} while (pte++, ...);
pte_unmap(pte - 1);

But if the loop breaks at the first loop, pte_unmap() unmaps invalid pte.

This patch is a fix for this problem.

Signed-off-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Reviewd-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory.c