nalika / rpms / grub2

Forked from rpms/grub2 2 years ago
Clone

Blame SOURCES/0219-Use-device-part-of-chainloader-target-if-present.patch

f725e3
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
f725e3
From: Raymund Will <rw@suse.com>
f725e3
Date: Fri, 10 Apr 2015 01:45:02 -0400
f725e3
Subject: [PATCH] Use device part of chainloader target, if present.
f725e3
f725e3
Otherwise chainloading is restricted to '$root', which might not even
f725e3
be readable by EFI!
f725e3
f725e3
v1. use grub_file_get_device_name() to get device name
f725e3
f725e3
Signed-off-by: Michael Chang <mchang@suse.com>
f725e3
Signed-off-by: Peter Jones <pjones@redhat.com>
f725e3
---
f725e3
 grub-core/loader/efi/chainloader.c | 7 +++++--
f725e3
 1 file changed, 5 insertions(+), 2 deletions(-)
f725e3
f725e3
diff --git a/grub-core/loader/efi/chainloader.c b/grub-core/loader/efi/chainloader.c
f725e3
index adc85636633..14ce6ddd7ad 100644
f725e3
--- a/grub-core/loader/efi/chainloader.c
f725e3
+++ b/grub-core/loader/efi/chainloader.c
f725e3
@@ -223,8 +223,11 @@ grub_cmd_chainloader (grub_command_t cmd __attribute__ ((unused)),
f725e3
   if (! file)
f725e3
     goto fail;
f725e3
 
f725e3
-  /* Get the root device's device path.  */
f725e3
-  dev = grub_device_open (0);
f725e3
+  /* Get the device path from filename. */
f725e3
+  char *devname = grub_file_get_device_name (filename);
f725e3
+  dev = grub_device_open (devname);
f725e3
+  if (devname)
f725e3
+    grub_free (devname);
f725e3
   if (! dev)
f725e3
     goto fail;
f725e3