tech-kern archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
test wanted: module plists
The code for loading a module plist from a file system is messed up in
that it calls namei() and then it calls vn_open() on the same
nameidata without reinitializing it or cleaning up the previous
results. I'm surprised this didn't result in fireworks, but apparently
it didn't.
The following patch fixes that, and compiles, but I'm not set up to be
able to test this -- is there anyone who can do so easily/quickly?
Index: kern_module_vfs.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_module_vfs.c,v
retrieving revision 1.3
diff -u -p -r1.3 kern_module_vfs.c
--- kern_module_vfs.c 16 Feb 2010 05:47:52 -0000 1.3
+++ kern_module_vfs.c 8 Mar 2010 02:33:36 -0000
@@ -147,23 +147,18 @@ module_load_plist_vfs(const char *modpat
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);
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index