summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/linux32/linux32_machdep.c4
-rw-r--r--sys/compat/freebsd32/freebsd32_misc.c4
-rw-r--r--sys/kern/kern_exec.c5
-rw-r--r--sys/sys/imgact.h1
4 files changed, 5 insertions, 9 deletions
diff --git a/sys/amd64/linux32/linux32_machdep.c b/sys/amd64/linux32/linux32_machdep.c
index 22ca3cb..b866929 100644
--- a/sys/amd64/linux32/linux32_machdep.c
+++ b/sys/amd64/linux32/linux32_machdep.c
@@ -200,9 +200,7 @@ linux_exec_copyin_args(struct image_args *args, char *fname,
return (0);
err_exit:
- kmem_free_wakeup(exec_map, (vm_offset_t)args->buf,
- PATH_MAX + ARG_MAX + MAXSHELLCMDLEN);
- args->buf = NULL;
+ exec_free_args(args);
return (error);
}
diff --git a/sys/compat/freebsd32/freebsd32_misc.c b/sys/compat/freebsd32/freebsd32_misc.c
index 1d60ed4..534c82c 100644
--- a/sys/compat/freebsd32/freebsd32_misc.c
+++ b/sys/compat/freebsd32/freebsd32_misc.c
@@ -355,9 +355,7 @@ freebsd32_exec_copyin_args(struct image_args *args, char *fname,
return (0);
err_exit:
- kmem_free_wakeup(exec_map, (vm_offset_t)args->buf,
- PATH_MAX + ARG_MAX + MAXSHELLCMDLEN);
- args->buf = NULL;
+ exec_free_args(args);
return (error);
}
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index 2aa4f70..1fa7444 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -105,7 +105,6 @@ static int sysctl_kern_usrstack(SYSCTL_HANDLER_ARGS);
static int sysctl_kern_stackprot(SYSCTL_HANDLER_ARGS);
static int do_execve(struct thread *td, struct image_args *args,
struct mac *mac_p);
-static void exec_free_args(struct image_args *);
/* XXX This should be vm_size_t. */
SYSCTL_PROC(_kern, KERN_PS_STRINGS, ps_strings, CTLTYPE_ULONG|CTLFLAG_RD,
@@ -1155,11 +1154,11 @@ err_exit:
return (error);
}
-static void
+void
exec_free_args(struct image_args *args)
{
- if (args->buf) {
+ if (args->buf != NULL) {
kmem_free_wakeup(exec_map, (vm_offset_t)args->buf,
PATH_MAX + ARG_MAX + MAXSHELLCMDLEN);
args->buf = NULL;
diff --git a/sys/sys/imgact.h b/sys/sys/imgact.h
index 1d1e361..d20c491 100644
--- a/sys/sys/imgact.h
+++ b/sys/sys/imgact.h
@@ -80,6 +80,7 @@ struct thread;
int exec_check_permissions(struct image_params *);
register_t *exec_copyout_strings(struct image_params *);
+void exec_free_args(struct image_args *);
int exec_new_vmspace(struct image_params *, struct sysentvec *);
void exec_setregs(struct thread *, struct image_params *, u_long);
int exec_shell_imgact(struct image_params *);
OpenPOWER on IntegriCloud