From: Avnish Chouhan <avnish@linux.ibm.com>
To: ssrish@linux.ibm.com
Cc: grub-devel@gnu.org, daniel.kiper@oracle.com
Subject: Re: [PATCH] aros/hostdisk: Fix use-after-free bug during MsgPort deletion
Date: Tue, 09 Dec 2025 14:29:50 +0530 [thread overview]
Message-ID: <dec6d380eb0fd46a27d84eeb8b949fe8@linux.ibm.com> (raw)
In-Reply-To: <mailman.51.1765213225.32209.grub-devel@gnu.org>
On 2025-12-08 22:30, grub-devel-request@gnu.org wrote:
> Message: 1
> Date: Mon, 8 Dec 2025 15:51:29 +0530
> 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
> Message-ID: <20251208102129.705955-1-ssrish@linux.ibm.com>
>
> 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.
Hi Srish,
Suggestion on commit message:
"In function grub_util_fd_open(), if creating an I/O request or opening
a device fails. 'ret' (the file descriptor) will be freed before its
associated MsgPort is deleted, resulting in a use-after-free condition.
Fixing this issue by freeing 'ret' after its associated MsgPort has been
deleted."
> Signed-off-by: Srish Srinivasan <ssrish@linux.ibm.com>
Reviewed-by: Avnish Chouhan <avnish@linux.ibm.com>
Regards,
Avnish Chouhan
> ---
> 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 parent reply other threads:[~2025-12-09 9:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.51.1765213225.32209.grub-devel@gnu.org>
2025-12-09 8:59 ` Avnish Chouhan [this message]
2025-12-08 10:21 [PATCH] aros/hostdisk: Fix use-after-free bug during MsgPort deletion Srish Srinivasan
2025-12-19 7:07 ` Sudhakar Kuppusamy
2025-12-29 15:59 ` Daniel Kiper
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=dec6d380eb0fd46a27d84eeb8b949fe8@linux.ibm.com \
--to=avnish@linux.ibm.com \
--cc=daniel.kiper@oracle.com \
--cc=grub-devel@gnu.org \
--cc=ssrish@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 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.