summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2020-11-07 03:28:32 +0000
committerKyle Evans <kevans@FreeBSD.org>2020-11-07 03:28:32 +0000
commit80083216cb0dbf4d1f9cde08c910ac383dc585e9 (patch)
tree37a16514e07ebd3deffc7fac0fec9acea6f610d8
parente25d8b67c3ad1ed040a983d901d3be616c024f79 (diff)
downloadsrc-test2-80083216cb0dbf4d1f9cde08c910ac383dc585e9.tar.gz
src-test2-80083216cb0dbf4d1f9cde08c910ac383dc585e9.zip
Notes
-rw-r--r--sys/kern/imgact_binmisc.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/sys/kern/imgact_binmisc.c b/sys/kern/imgact_binmisc.c
index 082dd3076b5e..af8f78cee59b 100644
--- a/sys/kern/imgact_binmisc.c
+++ b/sys/kern/imgact_binmisc.c
@@ -580,24 +580,24 @@ imgact_binmisc_exec(struct image_params *imgp)
struct sbuf *sname;
char *s, *d;
+ sname = NULL;
/* Do we have an interpreter for the given image header? */
sx_slock(&interp_list_sx);
if ((ibe = imgact_binmisc_find_interpreter(image_header)) == NULL) {
- sx_sunlock(&interp_list_sx);
- return (-1);
+ error = -1;
+ goto done;
}
/* No interpreter nesting allowed. */
if (imgp->interpreted & IMGACT_BINMISC) {
- sx_sunlock(&interp_list_sx);
- return (ENOEXEC);
+ error = ENOEXEC;
+ goto done;
}
imgp->interpreted |= IMGACT_BINMISC;
if (imgp->args->fname != NULL) {
fname = imgp->args->fname;
- sname = NULL;
} else {
/* Use the fdescfs(5) path for fexecve(2). */
sname = sbuf_new_auto();
@@ -636,7 +636,6 @@ imgact_binmisc_exec(struct image_params *imgp)
default:
/* Hmm... This shouldn't happen. */
- sx_sunlock(&interp_list_sx);
printf("%s: Unknown macro #%c sequence in "
"interpreter string\n", KMOD_NAME, *(s + 1));
error = EINVAL;
@@ -648,7 +647,6 @@ imgact_binmisc_exec(struct image_params *imgp)
/* Make room for the interpreter */
error = exec_args_adjust_args(imgp->args, 0, offset);
if (error != 0) {
- sx_sunlock(&interp_list_sx);
goto done;
}
@@ -698,11 +696,11 @@ imgact_binmisc_exec(struct image_params *imgp)
s++;
}
*d = '\0';
- sx_sunlock(&interp_list_sx);
imgp->interpreter_name = imgp->args->begin_argv;
done:
+ sx_sunlock(&interp_list_sx);
if (sname)
sbuf_delete(sname);
return (error);