From: Michael Olbrich <m.olbrich@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Michael Olbrich <m.olbrich@pengutronix.de>
Subject: [PATCH 5/5] efi: don't unload drivers
Date: Mon, 23 Jan 2017 18:02:18 +0100 [thread overview]
Message-ID: <20170123170218.25139-6-m.olbrich@pengutronix.de> (raw)
In-Reply-To: <20170123170218.25139-1-m.olbrich@pengutronix.de>
EFI applications should be unloaded to avoid leaking memory. However, boot
or runtime services continue in the background. So they must not be
unloaded.
Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
---
arch/efi/efi/efi-image.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/arch/efi/efi/efi-image.c b/arch/efi/efi/efi-image.c
index c780cad6d447..27f3c1b39c22 100644
--- a/arch/efi/efi/efi-image.c
+++ b/arch/efi/efi/efi-image.c
@@ -130,12 +130,16 @@ static int efi_execute_image(const char *file)
efi_status_t efiret;
struct linux_kernel_header *image_header;
const char *options;
+ bool is_driver;
int ret;
ret = efi_load_image(file, &loaded_image, &handle);
if (ret)
return ret;
+ is_driver = (loaded_image->image_code_type == EFI_BOOT_SERVICES_CODE) ||
+ (loaded_image->image_code_type == EFI_RUNTIME_SERVICES_CODE);
+
image_header = (struct linux_kernel_header *)loaded_image->image_base;
if (image_header->boot_flag == 0xAA55 &&
image_header->header == 0x53726448) {
@@ -152,7 +156,8 @@ static int efi_execute_image(const char *file)
if (EFI_ERROR(efiret))
pr_err("failed to StartImage: %s\n", efi_strerror(efiret));
- BS->unload_image(handle);
+ if (!is_driver)
+ BS->unload_image(handle);
efi_connect_all();
efi_register_devices();
--
2.11.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2017-01-23 17:03 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-23 17:02 [PATCH 0/5] EFI fixes Michael Olbrich
2017-01-23 17:02 ` [PATCH 1/5] readkey: keys are unsigned char Michael Olbrich
2017-01-23 17:02 ` [PATCH 2/5] serial: efi: improve input handling Michael Olbrich
2017-01-23 17:02 ` [PATCH 3/5] output: use '[0m' to reset colors Michael Olbrich
2017-01-23 17:02 ` [PATCH 4/5] efi: include and execute exit calls Michael Olbrich
2017-01-23 17:02 ` Michael Olbrich [this message]
2017-01-24 8:35 ` [PATCH 0/5] EFI fixes Sascha Hauer
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=20170123170218.25139-6-m.olbrich@pengutronix.de \
--to=m.olbrich@pengutronix.de \
--cc=barebox@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox