grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] push/pop errno in initrd read file path
@ 2016-03-11 16:28 Josef Bacik
  2016-03-11 16:28 ` [PATCH 2/3] tcp: add a dprintf for opening tcp connections Josef Bacik
                   ` (3 more replies)
  0 siblings, 4 replies; 13+ messages in thread
From: Josef Bacik @ 2016-03-11 16:28 UTC (permalink / raw)
  To: kernel-team, grub-devel

If you try to load an initrd from http and it errors out we will free the initrd
context but continue on because net_tcp_socket_close() will reset the grub_errno
as will grub_initrd_close().  So we'll lose the errno and return GRUB_ERR_NONE
instead of the original error.  Add push/pulls to the appropriate places so we
don't lose our errno.  Thanks,

Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 grub-core/loader/linux.c | 2 ++
 grub-core/net/http.c     | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c
index be6fa0f..bd61ca2 100644
--- a/grub-core/loader/linux.c
+++ b/grub-core/loader/linux.c
@@ -202,7 +202,9 @@ grub_initrd_init (int argc, char *argv[],
       initrd_ctx->components[i].file = grub_file_open (fname);
       if (!initrd_ctx->components[i].file)
 	{
+	  grub_error_push ();
 	  grub_initrd_close (initrd_ctx);
+	  grub_error_pop ();
 	  return grub_errno;
 	}
       initrd_ctx->nfiles++;
diff --git a/grub-core/net/http.c b/grub-core/net/http.c
index 4684f8b..0eeb2f6 100644
--- a/grub-core/net/http.c
+++ b/grub-core/net/http.c
@@ -406,7 +406,9 @@ http_establish (struct grub_file *file, grub_off_t offset, int initial)
   err = grub_net_send_tcp_packet (data->sock, nb, 1);
   if (err)
     {
+      grub_error_push ();
       grub_net_tcp_close (data->sock, GRUB_NET_TCP_ABORT);
+      grub_error_pop ();
       return err;
     }
 
-- 
2.5.0



^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2016-11-18 14:51 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-11 16:28 [PATCH 1/3] push/pop errno in initrd read file path Josef Bacik
2016-03-11 16:28 ` [PATCH 2/3] tcp: add a dprintf for opening tcp connections Josef Bacik
2016-03-11 16:28 ` [PATCH 3/3] pxenet: process transmit interrupts when out of resources Josef Bacik
2016-03-12  6:20   ` Andrei Borzenkov
2016-03-11 17:23 ` [PATCH 1/3] push/pop errno in initrd read file path Vladimir 'phcoder' Serbinenko
2016-03-11 18:13   ` Josef Bacik
2016-03-11 19:34     ` Vladimir 'phcoder' Serbinenko
2016-03-11 20:34       ` Josef Bacik
2016-03-11 22:00         ` Vladimir 'phcoder' Serbinenko
2016-03-12  7:01           ` Andrei Borzenkov
2016-03-15 17:26             ` Vladimir 'phcoder' Serbinenko
2016-11-10 12:49 ` Daniel Kiper
2016-11-18 14:51   ` Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).