Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern posix_spawn(2): Plug leak in proc_alloc error branch.



details:   https://anonhg.NetBSD.org/src/rev/2fda551ab2a3
branches:  trunk
changeset: 368238:2fda551ab2a3
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jul 01 01:05:31 2022 +0000

description:
posix_spawn(2): Plug leak in proc_alloc error branch.

diffstat:

 sys/kern/kern_exec.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r a5bc357ccb1a -r 2fda551ab2a3 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Fri Jul 01 01:05:21 2022 +0000
+++ b/sys/kern/kern_exec.c      Fri Jul 01 01:05:31 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.517 2022/04/09 23:38:33 riastradh Exp $        */
+/*     $NetBSD: kern_exec.c,v 1.518 2022/07/01 01:05:31 riastradh Exp $        */
 
 /*-
  * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.517 2022/04/09 23:38:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.518 2022/07/01 01:05:31 riastradh Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -2568,7 +2568,7 @@
        struct lwp *l2;
        int error;
        struct spawn_exec_data *spawn_data;
-       vaddr_t uaddr;
+       vaddr_t uaddr = 0;
        pid_t pid;
        bool have_exec_lock = false;
 
@@ -2852,6 +2852,8 @@
        }
        mutex_exit(&spawn_data->sed_mtx_child);
        spawn_exec_data_release(spawn_data);
+       if (uaddr != 0)
+               uvm_uarea_free(uaddr);
 
        return error;
 }



Home | Main Index | Thread Index | Old Index