public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: Ignore memory tags with invalid data
@ 2008-01-22  4:05 Corey Minyard
  2008-01-22  9:18 ` Ben Dooks
  2008-02-10 21:11 ` Byron Bradley
  0 siblings, 2 replies; 5+ messages in thread
From: Corey Minyard @ 2008-01-22  4:05 UTC (permalink / raw)
  To: Linux Kernel; +Cc: hvr, rmk, nico

From: Corey Minyard <minyard@acm.org>

The DNS-323 system has several bogus memory entries in the tag table,
and it caused the system to crash at startup.  Ignore tag entries that
are obviously bogus.

Signed-off-by: Corey Minyard <minyard@acm.org>
---
 arch/arm/kernel/setup.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index bf56eb3..dfdb469 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -630,7 +630,12 @@ __tagtable(ATAG_CORE, parse_tag_core);
 
 static int __init parse_tag_mem32(const struct tag *tag)
 {
-	if (meminfo.nr_banks >= NR_BANKS) {
+	/*
+	 * Make sure that the memory size is non-zero, page aligned,
+	 * and that it doesn't overflow the meminfo table.
+	 */
+	if (meminfo.nr_banks >= NR_BANKS || tag->u.mem.size & ~PAGE_MASK ||
+	    tag->u.mem.size == 0 || tag->u.mem.start & ~PAGE_MASK) {
 		printk(KERN_WARNING
 		       "Ignoring memory bank 0x%08x size %dKB\n",
 			tag->u.mem.start, tag->u.mem.size / 1024);

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-02-10 21:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-22  4:05 [PATCH] ARM: Ignore memory tags with invalid data Corey Minyard
2008-01-22  9:18 ` Ben Dooks
2008-01-22 14:34   ` Corey Minyard
2008-01-22 19:53     ` Russell King
2008-02-10 21:11 ` Byron Bradley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox