grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH]: Fix CDROM skipping in ieee1275 ofdisk iterator.


From: David Miller
Subject: [PATCH]: Fix CDROM skipping in ieee1275 ofdisk iterator.
Date: Sun, 06 Dec 2009 22:48:47 -0800 (PST)

We skip CDROMs in the block device iterator because they simply can't
be openned safely unless we absolutely know there is a CDROM drive
there and there is in fact a disc in the drive.

Openning it blindly results in either a 10 second hang during the open
call, or even worse a crash in OpenFirmware.

My SunBlade100 wouldn't boot a kernel properly because not only does
it by default have a "cdrom" alias, it also has two others named
"cdrom1" and "cdrom2".

So to cover all cases, match "cdrom" as a 5 character prefix of the
alias name in the check.

I tried to surmise other ways to do this more cleanly, such as
resolving the path and looking for some device property inside of the
resulting node, but there simply isn't anything we can check for.

BTW, if people want to look at some OpenFirmware device tree dumps on
just about every sparc64 system type there is a GIT repo where we
maintain such things contributed by various sparc64 Linux users at:

        git://git.kernel.org/pub/scm/linux/kernel/git/davem/prtconfs.git

There are some 32-bit sparc dumps in there, but the majority are
64-bit systems.

Anyways, here is the fix, please apply thanks!

2009-12-06  David S. Miller  <address@hidden>

        * disk/ieee1275/ofdisk.c (grub_ofdisk_iterate): Recognize
        anything even prefixed with 'cdrom' as a cdrom.

=== modified file 'disk/ieee1275/ofdisk.c'
--- disk/ieee1275/ofdisk.c      2009-06-10 21:04:23 +0000
+++ disk/ieee1275/ofdisk.c      2009-12-07 02:13:52 +0000
@@ -107,7 +107,7 @@
        }
 
       if (! grub_strcmp (alias->type, "block") &&
-         grub_strcmp (alias->name, "cdrom"))
+         grub_strncmp (alias->name, "cdrom", 5))
        ret = hook (alias->name);
       return ret;
     }





reply via email to

[Prev in Thread] Current Thread [Next in Thread]