public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix xenU kernel crash in dmi_iterate
@ 2005-01-14 19:49 Rik van Riel
  2005-01-14 22:03 ` Ulrich Drepper
  0 siblings, 1 reply; 2+ messages in thread
From: Rik van Riel @ 2005-01-14 19:49 UTC (permalink / raw)
  To: Andrew Morton; +Cc: linux-kernel, Ian Pratt

Hi Andrew,

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.

Signed-off-by: Rik van Riel <riel@redhat.com>

--- linux/arch/i386/kernel/dmi_scan.c.orig	2005-01-12 14:55:14.000000000 -0500
+++ linux/arch/i386/kernel/dmi_scan.c	2005-01-12 16:06:27.000000000 -0500
@@ -105,6 +105,8 @@
  	char __iomem *p, *q;

  	for (p = q = ioremap(0xF0000, 0x10000); q < p + 0x10000; q += 16) {
+		if (p == NULL)
+			return -1;
  		memcpy_fromio(buf, q, 15);
  		if(memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf))
  		{

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

* Re: [PATCH] fix xenU kernel crash in dmi_iterate
  2005-01-14 19:49 [PATCH] fix xenU kernel crash in dmi_iterate Rik van Riel
@ 2005-01-14 22:03 ` Ulrich Drepper
  0 siblings, 0 replies; 2+ messages in thread
From: Ulrich Drepper @ 2005-01-14 22:03 UTC (permalink / raw)
  To: Rik van Riel; +Cc: Andrew Morton, linux-kernel, Ian Pratt

On Fri, 14 Jan 2005 14:49:10 -0500 (EST), Rik van Riel <riel@redhat.com> wrote:
>         char __iomem *p, *q;
> 
>         for (p = q = ioremap(0xF0000, 0x10000); q < p + 0x10000; q += 16) {
> +               if (p == NULL)
> +                       return -1;
>                 memcpy_fromio(buf, q, 15);
>                 if(memcmp(buf, "_DMI_", 5)==0 && dmi_checksum(buf))
>                 {

SInce p is not modified in the loop, this certainly should look like this

p = ioremap(0xF0000, 0x10000);
if (p == NULL)
  return -1;
for (q = p; q < p + 0x10000; q += 16) {
  memcpy_fromio(buf, q, 15);
  ...

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

end of thread, other threads:[~2005-01-14 22:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-14 19:49 [PATCH] fix xenU kernel crash in dmi_iterate Rik van Riel
2005-01-14 22:03 ` Ulrich Drepper

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