From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>,
Chali Anis <chalianis1@gmail.com>
Subject: [PATCH] boot: don't use the nfs:// mount path after freeing it
Date: Wed, 26 Aug 2026 12:13:33 +0200 [thread overview]
Message-ID: <20260826101335.2682621-1-a.fatoum@pengutronix.de> (raw)
We free nfspath, while there is still a dangling reference to it in
the `name' variable:
nfspath = parse_nfs_url(name);
if (nfspath)
name = nfspath;
...
free(nfspath);
if (IS_ENABLED(CONFIG_COMMAND_SUPPORT) && !found) {
const char *path;
if (*name != '/')
Fix this by freeing it at the end of function.
Fixes: b5c00912524d ("boot: move nfs:// parsing out of bootloader spec code")
Reported-by: Chali Anis <chalianis1@gmail.com>
Assisted-by: Claude:opus-5
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
common/boot.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/boot.c b/common/boot.c
index dc1441d0dc91..0dbe8784d40c 100644
--- a/common/boot.c
+++ b/common/boot.c
@@ -473,8 +473,6 @@ int bootentry_create_from_name(struct bootentries *bootentries,
bootentries_merge(bootentries, &provider_bootentries);
}
- free(nfspath);
-
if (IS_ENABLED(CONFIG_COMMAND_SUPPORT) && !found) {
const char *path;
@@ -490,6 +488,8 @@ int bootentry_create_from_name(struct bootentries *bootentries,
free_const(path);
}
+ free(nfspath);
+
return found;
}
--
2.47.3
next reply other threads:[~2026-08-26 10:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 10:13 Ahmad Fatoum [this message]
2026-08-28 12:16 ` 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=20260826101335.2682621-1-a.fatoum@pengutronix.de \
--to=a.fatoum@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=chalianis1@gmail.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