Source-Changes-HG archive

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

[src/trunk]: src/sys/kern check for errors from proc_vmspace_getref().



details:   https://anonhg.NetBSD.org/src/rev/25e5f23d543c
branches:  trunk
changeset: 745101:25e5f23d543c
user:      chs <chs%NetBSD.org@localhost>
date:      Sat Feb 22 21:59:30 2020 +0000

description:
check for errors from proc_vmspace_getref().

diffstat:

 sys/kern/subr_copy.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (37 lines):

diff -r 2a988865d86f -r 25e5f23d543c sys/kern/subr_copy.c
--- a/sys/kern/subr_copy.c      Sat Feb 22 21:45:34 2020 +0000
+++ b/sys/kern/subr_copy.c      Sat Feb 22 21:59:30 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: subr_copy.c,v 1.11 2019/04/07 16:27:41 thorpej Exp $   */
+/*     $NetBSD: subr_copy.c,v 1.12 2020/02/22 21:59:30 chs Exp $       */
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2002, 2007, 2008, 2019
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: subr_copy.c,v 1.11 2019/04/07 16:27:41 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_copy.c,v 1.12 2020/02/22 21:59:30 chs Exp $");
 
 #define        __UFETCHSTORE_PRIVATE
 #define        __UCAS_PRIVATE
@@ -321,13 +321,14 @@
                return ESRCH;
        }
        mutex_enter(p->p_lock);
-       proc_vmspace_getref(p, &vm);
+       error = proc_vmspace_getref(p, &vm);
        mutex_exit(p->p_lock);
        mutex_exit(proc_lock);
 
-       error = copyin_vmspace(vm, uaddr, kaddr, len);
-
-       uvmspace_free(vm);
+       if (error == 0) {
+               error = copyin_vmspace(vm, uaddr, kaddr, len);
+               uvmspace_free(vm);
+       }
        return error;
 }
 



Home | Main Index | Thread Index | Old Index