On Mon Mar 08 2010 at 02:37:05 +0000, David Holland wrote: > 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?
When I was playing with that code, I used atf on tests/modules. I can't remember if it tests loading from .prop, but a .prop file isn't exactly hard to create. Dunno what the canonical in-tree feature using this is, though. > 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 > dholl...@netbsd.org