![]() | |||||||||||||
Messages in this thread Patch in this message |
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; - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ | ||||||||||||
| Last update: 2005-03-22 13:01 [W:0.918 / U:0.110 seconds] ©2003-2008 Jasper Spaans | |||||||||||||