From 6bf9a070366cda4ed71a1a9ac4bcdb0c7c8dc868 Mon Sep 17 00:00:00 2001 From: rmind Date: Wed, 12 May 2010 03:40:38 +0000 Subject: [PATCH] execve1: move few PNBUF_PUT() outside the lock paths. --- sys/kern/kern_exec.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c index 8d920a43a218..50e24b749dc8 100644 --- a/sys/kern/kern_exec.c +++ b/sys/kern/kern_exec.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_exec.c,v 1.296 2010/05/02 23:22:51 dholland Exp $ */ +/* $NetBSD: kern_exec.c,v 1.297 2010/05/12 03:40:38 rmind Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.296 2010/05/02 23:22:51 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.297 2010/05/12 03:40:38 rmind Exp $"); #include "opt_ktrace.h" #include "opt_modular.h" @@ -1209,9 +1209,10 @@ execve1(struct lwp *l, const char *path, char * const *args, lwp_lock(l); l->l_flag |= oldlwpflags; lwp_unlock(l); - PNBUF_PUT(pathbuf); rw_exit(&p->p_reflock); + PNBUF_PUT(pathbuf); + if (modgen != module_gen && error == ENOEXEC) { modgen = module_gen; exec_autoload(); @@ -1223,11 +1224,12 @@ execve1(struct lwp *l, const char *path, char * const *args, exec_abort: SDT_PROBE(proc,,,exec_failure, error, 0, 0, 0, 0); - PNBUF_PUT(pathbuf); - PNBUF_PUT(resolvedpathbuf); rw_exit(&p->p_reflock); rw_exit(&exec_lock); + PNBUF_PUT(pathbuf); + PNBUF_PUT(resolvedpathbuf); + /* * the old process doesn't exist anymore. exit gracefully. * get rid of the (new) address space we have created, if any, get rid