Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern don't leak a vnode and don't call namei (implicitly...
details: https://anonhg.NetBSD.org/src/rev/57d3f3dd2f4e
branches: trunk
changeset: 753625:57d3f3dd2f4e
user: jnemeth <jnemeth%NetBSD.org@localhost>
date: Sun Apr 04 17:18:04 2010 +0000
description:
don't leak a vnode and don't call namei (implicitly) twice
diffstat:
sys/kern/kern_module_vfs.c | 19 +++++++------------
1 files changed, 7 insertions(+), 12 deletions(-)
diffs (47 lines):
diff -r ee9bfa476c75 -r 57d3f3dd2f4e sys/kern/kern_module_vfs.c
--- a/sys/kern/kern_module_vfs.c Sun Apr 04 14:46:35 2010 +0000
+++ b/sys/kern/kern_module_vfs.c Sun Apr 04 17:18:04 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_module_vfs.c,v 1.3 2010/02/16 05:47:52 dholland Exp $ */
+/* $NetBSD: kern_module_vfs.c,v 1.4 2010/04/04 17:18:04 jnemeth Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.3 2010/02/16 05:47:52 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.4 2010/04/04 17:18:04 jnemeth Exp $");
#define _MODULE_INTERNAL
#include <sys/param.h>
@@ -147,23 +147,18 @@
NDINIT(&nd, LOOKUP, FOLLOW | (nochroot ? NOCHROOT : 0),
UIO_SYSSPACE, proppath);
- error = namei(&nd);
- if (error != 0) {
- goto out1;
+ error = vn_open(&nd, FREAD, 0);
+ if (error != 0) {
+ goto out1;
}
error = vn_stat(nd.ni_vp, &sb);
if (error != 0) {
- goto out1;
+ goto out;
}
if (sb.st_size >= (plistsize - 1)) { /* leave space for term \0 */
error = EFBIG;
- goto out1;
- }
-
- error = vn_open(&nd, FREAD, 0);
- if (error != 0) {
- goto out1;
+ goto out;
}
base = kmem_alloc(plistsize, KM_SLEEP);
Home |
Main Index |
Thread Index |
Old Index