From: Srish Srinivasan <ssrish@linux.ibm.com>
To: grub-devel@gnu.org
Cc: daniel.kiper@oracle.com, sudhakar@linux.ibm.com,
sridharm@linux.ibm.com, ssrish@linux.ibm.com
Subject: [PATCH] aros/hostdisk: Fix use-after-free bug during MsgPort deletion
Date: Mon, 8 Dec 2025 15:51:29 +0530 [thread overview]
Message-ID: <20251208102129.705955-1-ssrish@linux.ibm.com> (raw)
Inside grub_util_fd_open, a failure while creating an IO
request or opening a device frees ret (the fd) before its
MsgPort is deleted. This leads to a use-after-free scenario.
Fix this by freeing ret after its MsgPort has been deleted.
Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
---
grub-core/osdep/aros/hostdisk.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/grub-core/osdep/aros/hostdisk.c b/grub-core/osdep/aros/hostdisk.c
index 08723bd45..c75474933 100644
--- a/grub-core/osdep/aros/hostdisk.c
+++ b/grub-core/osdep/aros/hostdisk.c
@@ -207,8 +207,8 @@ grub_util_fd_open (const char *dev, int flg)
sizeof(struct IOExtTD));
if (!ret->ioreq)
{
- free (ret);
DeleteMsgPort (ret->mp);
+ free (ret);
return NULL;
}
@@ -225,9 +225,9 @@ grub_util_fd_open (const char *dev, int flg)
if (OpenDevice ((unsigned char *) tmp, unit,
(struct IORequest *) ret->ioreq, flags))
{
- free (tmp);
- free (ret);
DeleteMsgPort (ret->mp);
+ free (ret);
+ free (tmp);
return NULL;
}
free (tmp);
--
2.43.0
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next reply other threads:[~2025-12-08 10:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 10:21 Srish Srinivasan [this message]
2025-12-19 7:07 ` [PATCH] aros/hostdisk: Fix use-after-free bug during MsgPort deletion Sudhakar Kuppusamy
2025-12-29 15:59 ` Daniel Kiper
[not found] <mailman.51.1765213225.32209.grub-devel@gnu.org>
2025-12-09 8:59 ` Avnish Chouhan
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=20251208102129.705955-1-ssrish@linux.ibm.com \
--to=ssrish@linux.ibm.com \
--cc=daniel.kiper@oracle.com \
--cc=grub-devel@gnu.org \
--cc=sridharm@linux.ibm.com \
--cc=sudhakar@linux.ibm.com \
/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