* grub-core/kern/emu/getroot.c (grub_guess_root_device): Don't accept
/dev/root as a valid device.
This commit is contained in:
parent
8a5d6919e1
commit
e2d1dba0ae
2 changed files with 11 additions and 3 deletions
|
@ -1,6 +1,12 @@
|
|||
2011-06-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* grub-core/kern/emu/getroot.c (grub_guess_root_device): Don't accept
|
||||
/dev/root as a valid device.
|
||||
|
||||
2011-06-23 Jim Meyering <meyering@redhat.com>
|
||||
|
||||
avoid NULL deref in grub_device_open
|
||||
Avoid NULL deref in grub_device_open.
|
||||
|
||||
* grub-core/kern/device.c (grub_device_open): Don't dereference
|
||||
a NULL pointer upon failed grub_env_get.
|
||||
|
||||
|
|
|
@ -616,13 +616,15 @@ grub_guess_root_device (const char *dir)
|
|||
|
||||
if (os_dev)
|
||||
{
|
||||
if (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) != 0)
|
||||
int dm = (strncmp (os_dev, "/dev/dm-", sizeof ("/dev/dm-") - 1) == 0);
|
||||
int root = (strcmp (os_dev, "/dev/root") == 0);
|
||||
if (!dm && !root)
|
||||
return os_dev;
|
||||
if (stat (os_dev, &st) < 0)
|
||||
grub_util_error ("cannot stat `%s'", os_dev);
|
||||
free (os_dev);
|
||||
dev = st.st_rdev;
|
||||
return grub_find_device ("/dev/mapper", dev);
|
||||
return grub_find_device (dm ? "/dev/mapper" : "/dev", dev);
|
||||
}
|
||||
|
||||
if (stat (dir, &st) < 0)
|
||||
|
|
Loading…
Reference in a new issue