浏览代码

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 <lethal@linux-sh.org>
Paul Mundt 15 年之前
父节点
当前提交
55cef91a5d
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      arch/sh/mm/pmb.c

+ 1 - 1
arch/sh/mm/pmb.c

@@ -77,7 +77,7 @@ static struct pmb_entry *pmb_alloc(unsigned long vpn, unsigned long ppn,
 		if (pos < 0)
 		if (pos < 0)
 			return ERR_PTR(pos);
 			return ERR_PTR(pos);
 	} else {
 	} else {
-		if (test_bit(entry, &pmb_map))
+		if (test_and_set_bit(entry, &pmb_map))
 			return ERR_PTR(-ENOSPC);
 			return ERR_PTR(-ENOSPC);
 		pos = entry;
 		pos = entry;
 	}
 	}