dcavalca / rpms / grub2

Forked from rpms/grub2 3 years ago
Clone

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

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