Commit f39f308b authored by Rik van Riel's avatar Rik van Riel Committed by Linus Torvalds

[PATCH] fix xenU kernel crash in dmi_iterate

In unprivileged Xen domains, all that __ioremap() does is a "return NULL",
which causes dmi_iterate() to crash the kernel at boot time.

This trivial check bails dmi_iterate() out of the loop when it finds that
the ioremap() returned a NULL pointer.

(akpm: this fix goes beyond xen - ioremap can return NULL)
Signed-off-by: default avatarRik van Riel <riel@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 7b2f8055
......@@ -109,7 +109,10 @@ static int __init dmi_iterate(void (*decode)(struct dmi_header *))
* so early in setup that sucker gets confused into doing what
* it shouldn't if we actually call it.
*/
for (p = q = ioremap(0xF0000, 0x10000); q < p + 0x10000; q += 16) {
p = ioremap(0xF0000, 0x10000);
if (p == NULL)
return -1;
for (q = p; q < p + 0x10000; q += 16) {
memcpy_fromio(buf, q, 15);
if(memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf))
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment