From: Paul Mundt Date: Tue, 16 Feb 2010 08:14:04 +0000 (+0900) Subject: sh: Prevent fixed slot PMB remapping from clobbering boot entries. X-Git-Tag: v2.6.34-rc1~285^2~17^2~12 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=55cef91a5d553265f03fe159f9fcdfac36902248;p=karo-tx-linux.git sh: Prevent fixed slot PMB remapping from clobbering boot entries. The PMB initialization code walks the entries and synchronizes the software PMB state with the hardware mappings, preserving the slot index. Unfortunately pmb_alloc() only tested the bit position in the entry map and failed to set it, resulting in subsequent remaps being able to be dynamically assigned a slot that trampled an existing boot mapping with general badness ensuing. Signed-off-by: Paul Mundt --- diff --git a/arch/sh/mm/pmb.c b/arch/sh/mm/pmb.c index 3c9bf5b5c36f..a06483076a41 100644 --- a/arch/sh/mm/pmb.c +++ b/arch/sh/mm/pmb.c @@ -77,7 +77,7 @@ static struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn, if (pos < 0) return ERR_PTR(pos); } else { - if (test_bit(entry, &pmb_map)) + if (test_and_set_bit(entry, &pmb_map)) return ERR_PTR(-ENOSPC); pos = entry; }