git: f9d0f90a06e2 - main - loader: fix double free of vectx on verification failure
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 26 Nov 2026 04:02:28 UTC
The branch main has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=f9d0f90a06e2776749c6f84bf552cfc45a754dca
commit f9d0f90a06e2776749c6f84bf552cfc45a754dca
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2026-11-26 04:00:54 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2026-11-26 04:01:03 +0000
loader: fix double free of vectx on verification failure
vectx_close() always frees the context it is handed, but both
file_loadraw() and the i386 chain command would free(vctx) again when
it reported a verification failure.
Reviewed by: imp, sjg
Sponsored by: The FreeBSD Foundation
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D61839
---
stand/common/module.c | 1 -
stand/i386/loader/chain.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/stand/common/module.c b/stand/common/module.c
index a2da303573ff..f2adb84b9099 100644
--- a/stand/common/module.c
+++ b/stand/common/module.c
@@ -757,7 +757,6 @@ file_loadraw(const char *fname, const char *type, int insert)
if (verror) {
free(name);
close(fd);
- free(vctx);
TSEXIT();
return(NULL);
}
diff --git a/stand/i386/loader/chain.c b/stand/i386/loader/chain.c
index 5d8d66039770..13dd4377ea1d 100644
--- a/stand/i386/loader/chain.c
+++ b/stand/i386/loader/chain.c
@@ -129,7 +129,6 @@ command_chain(int argc, char *argv[])
#ifdef LOADER_VERIEXEC_VECTX
verror = vectx_close(vctx, __func__);
if (verror) {
- free(vctx);
return (CMD_ERROR);
}
#endif