public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Elliot Mackenzie" <macka@adixein.com>
To: "'Len Brown'" <len.brown@intel.com>,
	"'Randy.Dunlap'" <rddunlap@osdl.org>
Cc: <linux-kernel@vger.kernel.org>
Subject: [PATCH]: PROBLEM: Panic booting from USB disk in ioremap.c (line 81)
Date: Sun, 29 Feb 2004 15:28:55 +1000	[thread overview]
Message-ID: <001101c3fe84$eec59450$4301a8c0@waverunner> (raw)
In-Reply-To: <1077783113.22401.69.camel@dhcppc4>

Kernel-devs:

This patch simply adds a sanity check to bootflag.c to detect a bad RSDT
pointer and avoids a kernel panic on boot with some buggy BIOSes.  The
patch is an "interim" patch, as we believe Len Brown has plans to use
the ACPI code to manage SBF in future.

Initial post:
>We have a problem booting vanilla 2.6.2 and 2.6.3 kernels from a USB
disk >(Transcend JetFlash, both 128MB USB 2 and 256MB USB 1). During
what appears >to be PCI device enumeration, we get the following panic:

Len Brown:
>bootflag.c should not use its own private ACPI table parser/mapper --
>this is a bug:
>http://bugme.osdl.org/show_bug.cgi?id=1922

This is an interim patch for anyone that is wrestling with the same
issue.  
Thank you to Randy Dunlap for his helpful assistance early in the
process (and for some of the code below).  

Kind regards,
Doug Turk and Elliot Mackenzie.


========================================================================
====
--- linux-2.6.3/arch/i386/kernel/bootflag.c	Wed Feb 18 13:59:06 2004
+++ linux-2.6.3-doug/arch/i386/kernel/bootflag.c	Tue Feb 24
23:18:51 2004
@@ -192,22 +192,37 @@
 	}
 	if(i>0xFFFE0)
 		return 0;
-		
-		
+
 	rsdt = ioremap(rsdtbase, rsdtlen);
 	if(rsdt == 0)
 		return 0;
-		
-	i = readl(rsdt + 4);
+
+	/* Check the RSDT signature */
+	if (memcmp(rsdt, "RSDT", 4))
+	{
+		iounmap(rsdt);
+		printk(KERN_WARNING "SBF: Could not map RSDT: bad
signature\n");
+		return 0;
+	}
+
 	
 	/*
 	 *	Remap if needed
 	 */
-	 
+	i = readl(rsdt + 4);
+
 	if(i > rsdtlen)
 	{
 		rsdtlen = i;
 		iounmap(rsdt);
+		/* Verify that the RSDT length is sane. */
+		if (rsdtlen > 0x1000) {	/* arbitrary for now */
+			printk(KERN_ERR "SBF: invalid rsdtlen = 0x%x\n",
+					rsdtlen);
+			return 0;
+		}
+
 		rsdt = ioremap(rsdtbase, rsdtlen);
 		if(rsdt == 0)
 			return 0;



      reply	other threads:[~2004-02-29  5:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <A6974D8E5F98D511BB910002A50A6647615F32F8@hdsmsx402.hd.intel.com>
2004-02-26  8:11 ` PROBLEM: Panic booting from USB disk in ioremap.c (line 81) Len Brown
2004-02-29  5:28   ` Elliot Mackenzie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='001101c3fe84$eec59450$4301a8c0@waverunner' \
    --to=macka@adixein.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rddunlap@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox