All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH]: Fix CDROM skipping in ieee1275 ofdisk iterator.
@ 2009-12-07  6:48 David Miller
  2009-12-07 11:05 ` Vladimir 'φ-coder/phcoder' Serbinenko
  0 siblings, 1 reply; 5+ messages in thread
From: David Miller @ 2009-12-07  6:48 UTC (permalink / raw)
  To: grub-devel


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  <davem@sunset.davemloft.net>

	* 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;
     }




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

end of thread, other threads:[~2009-12-07 19:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-07  6:48 [PATCH]: Fix CDROM skipping in ieee1275 ofdisk iterator David Miller
2009-12-07 11:05 ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-07 11:21   ` David Miller
2009-12-07 11:52     ` Vladimir 'φ-coder/phcoder' Serbinenko
2009-12-07 19:49       ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.