All of lore.kernel.org
 help / color / mirror / Atom feed
From: Valentin Gehrke <valentin.gehrke@kernkonzept.com>
To: grub-devel@gnu.org
Subject: [PATCH] loader/multiboot: do not add modules before successful download
Date: Fri, 23 Aug 2024 20:20:53 +0200	[thread overview]
Message-ID: <20240823202024.6be556fb@Devinator> (raw)

Multiboot modules that could not be read successfully (e.g. via network)
should not be added to the list of modules to forward to the operating
system that is to be booted subsequently.

This patch is necessary because even if a grub.cfg checks whether or not
a module was successfully downloaded, an attempt to retry a failed
download is futile because the corrupted module will be forwarded either
way.

Signed-off-by: Valentin Gehrke <valentin.gehrke@kernkonzept.com>
---
 grub-core/loader/multiboot.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/grub-core/loader/multiboot.c b/grub-core/loader/multiboot.c
index 94be512c4..36b27a906 100644
--- a/grub-core/loader/multiboot.c
+++ b/grub-core/loader/multiboot.c
@@ -420,13 +420,6 @@ grub_cmd_module (grub_command_t cmd __attribute__
((unused)), target = 0;
     }
 
-  err = GRUB_MULTIBOOT (add_module) (target, size, argc - 1, argv + 1);
-  if (err)
-    {
-      grub_file_close (file);
-      return err;
-    }
-
   if (size && grub_file_read (file, module, size) != size)
     {
       grub_file_close (file);
@@ -437,7 +430,8 @@ grub_cmd_module (grub_command_t cmd __attribute__
((unused)), }
 
   grub_file_close (file);
-  return GRUB_ERR_NONE;
+
+  return GRUB_MULTIBOOT (add_module) (target, size, argc - 1, argv +
1); }
 
 static grub_command_t cmd_multiboot, cmd_module;
-- 
2.45.2

---
Valentin Gehrke
Software Engineer
Kernkonzept GmbH at Dresden, Germany,
HRB 31129, CEO Dr.-Ing. Michael Hohmuth

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

             reply	other threads:[~2024-08-23 20:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-23 18:20 Valentin Gehrke [this message]
2024-09-02 16:44 ` [PATCH] loader/multiboot: do not add modules before successful download Daniel Kiper
2024-09-10 13:05 ` Daniel Kiper
2024-09-10 14:10   ` Valentin Gehrke
2024-10-25 11:59     ` Valentin Gehrke
2024-10-30 15:15       ` Daniel Kiper
2024-10-30 17:08         ` Valentin Gehrke
     [not found] <ZyJoC5WLe+vhuUzs@tomti.i.net-space.pl>
2024-10-30 17:12 ` Valentin Gehrke

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240823202024.6be556fb@Devinator \
    --to=valentin.gehrke@kernkonzept.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.