Commit 3d8df86d authored by Eric Snowberg's avatar Eric Snowberg Committed by Daniel Kiper

ls: prevent double open

Prevent a double open.  This can cause problems with some ieee1275
devices, causing the system to hang.  The double open can occur
as follows:

grub_ls_list_files (char *dirname, int longlist, int all, int human)
       dev = grub_device_open (device_name);
       dev remains open while:
       grub_normal_print_device_info (device_name);
                dev = grub_device_open (name);
Signed-off-by: default avatarEric Snowberg <>
Signed-off-by: default avatarDaniel Kiper <>
Reviewed-by: default avatarDaniel Kiper <>
parent 446794de
......@@ -201,6 +201,15 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
grub_errno = GRUB_ERR_NONE;
* Close device to prevent a double open in grub_normal_print_device_info().
* Otherwise it may lead to hangs on some IEEE 1275 platforms.
grub_device_close (dev);
dev = NULL;
grub_normal_print_device_info (device_name);
else if (fs)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment