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