ls: prevent double open
PATCH v2 1/1 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);---
changes from v1:
- Added comment
--- grub-core/commands/ls.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
grub-core/commands/ls.c +4 -0
@@ -201,6 +201,10 @@ 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. */ +grub_device_close (dev); + dev =NULL ;grub_normal_print_device_info (device_name); }else if (fs)
Signature · 1 line
1.7.1
Quoted 23 lines · Eric Snowberg
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 Eric Snowberg <[email protected]>---
changes from v1:
- Added comment--- grub-core/commands/ls.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)grub-core/commands/ls.c +0
-0
grub-core/commands/ls.c grub_ls_list_files (char *dirname, int longlist, int all, int human) · line 207
Quoted 7 lines
grub-core/commands/ls.c +4
-0@@ -201,6 +201,10 @@ 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. */ +grub_device_close (dev); + dev =NULL ;
Are you OK if I put above between "#ifdef GRUB_MACHINE_IEEE1275" and "#endif"?
Daniel
Quoted 30 lines · Daniel Kiper
Quoted 26 lines · Eric Snowberg
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 Eric Snowberg <[email protected]>---
changes from v1:
- Added comment
---grub-core/commands/ls.c| 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)grub-core/commands/ls.c +0
-0@@ -201,6 +201,10 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)if (grub_errno ==GRUB_ERR_UNKNOWN_FS ) grub_errno =GRUB_ERR_NONE ;
Quoted 6 lines
grub-core/commands/ls.c grub_ls_list_files (char *dirname, int longlist, int all, int human) · line 207
Quoted 4 lines
grub-core/commands/ls.c +4
-0+/* Close device to prevent a double open in +grub_normal_print_device_info. */ +grub_device_close (dev); + dev =NULL ;Are you OK if I put above between "#ifdef
GRUB_MACHINE_IEEE1275" and "#endif”?
I suppose you could add that. Is this patch causing problems on a different platform?
Quoted 28 lines · Eric Snowberg
Quoted 28 lines · Daniel Kiper
Quoted 26 lines · Eric Snowberg
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 Eric Snowberg <[email protected]>---
changes from v1:
- Added comment
---grub-core/commands/ls.c| 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)grub-core/commands/ls.c +0
-0@@ -201,6 +201,10 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)if (grub_errno ==GRUB_ERR_UNKNOWN_FS ) grub_errno =GRUB_ERR_NONE ;
Quoted 8 lines
Quoted 6 lines
grub-core/commands/ls.c grub_ls_list_files (char *dirname, int longlist, int all, int human) · line 207
Quoted 4 lines
grub-core/commands/ls.c +4
-0+/* Close device to prevent a double open in +grub_normal_print_device_info. */ +grub_device_close (dev); + dev =NULL ;Are you OK if I put above between "#ifdef
GRUB_MACHINE_IEEE1275" and "#endif”?I suppose you could add that.
Great!
Quoted 1 line
Is this patch causing problems on a different platform?
Nope, but I would like to be on safe side. So, I will add it and push.
Daniel
Quoted 3 lines · Daniel Kiper
Quoted 1 line
Is this patch causing problems on a different platform?
Nope, but I would like to be on safe side. So, I will add it and push.
Great \o/. Progress :).
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Quoted 36 lines · Daniel Kiper
Quoted 35 lines · Eric Snowberg
Quoted 34 lines · Daniel Kiper
Quoted 23 lines · Eric Snowberg
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 Eric Snowberg <[email protected]>---
changes from v1:
- Added comment
---grub-core/commands/ls.c| 4 ++++1 files changed, 4 insertions(+), 0 deletions(-)grub-core/commands/ls.c +0
-0grub-core/commands/ls.c grub_ls_list_files (char *dirname, int longlist, int all, int human) · line 207
Quoted 7 lines
grub-core/commands/ls.c +4
-0@@ -201,6 +201,10 @@ 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. */ +grub_device_close (dev); + dev =NULL ;Are you OK if I put above between "#ifdef
GRUB_MACHINE_IEEE1275" and "#endif”?
Quoted 7 lines
Quoted 1 line
I suppose you could add that.
Great!
Quoted 1 line
Is this patch causing problems on a different platform?
Nope, but I would like to be on safe side. So, I will add it and push.
Pushed!
Daniel