summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_linker.c
diff options
context:
space:
mode:
authorjeff <jeff@FreeBSD.org>2002-07-07 22:35:47 +0000
committerjeff <jeff@FreeBSD.org>2002-07-07 22:35:47 +0000
commit3039c3296a94106843aea1bdc2abcc05797e3b9b (patch)
tree948ebbd498386a750658643fbe40aeb883a1a0e5 /sys/kern/kern_linker.c
parentfeeea8100f5cbff2b5b9ca4e8286f82754a6df83 (diff)
downloadFreeBSD-src-3039c3296a94106843aea1bdc2abcc05797e3b9b.zip
FreeBSD-src-3039c3296a94106843aea1bdc2abcc05797e3b9b.tar.gz
- Delay unlocking a vnode in linker_hints_lookup until we're actually done
with it. - Remove a now stale comment about improper vnode locking.
Diffstat (limited to 'sys/kern/kern_linker.c')
-rw-r--r--sys/kern/kern_linker.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index a506726..b5c1f7d 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -1421,9 +1421,6 @@ linker_lookup_file(const char *path, int pathlen, const char *name,
* Lookup KLD which contains requested module in the "linker.hints" file. If
* version specification is available, then try to find the best KLD.
* Otherwise just find the latest one.
- *
- * XXX: Vnode locking here is hosed; lock should be held for calls to
- * VOP_GETATTR() and vn_rdwr().
*/
static char *
linker_hints_lookup(const char *path, int pathlen, const char *modname,
@@ -1453,7 +1450,6 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
if (error)
goto bad;
NDFREE(&nd, NDF_ONLY_PNBUF);
- VOP_UNLOCK(nd.ni_vp, 0, td);
if (nd.ni_vp->v_type != VREG)
goto bad;
best = cp = NULL;
@@ -1474,6 +1470,7 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
UIO_SYSSPACE, IO_NODELOCKED, cred, &reclen, td);
if (error)
goto bad;
+ VOP_UNLOCK(nd.ni_vp, 0, td);
vn_close(nd.ni_vp, FREAD, cred, td);
nd.ni_vp = NULL;
if (reclen != 0) {
@@ -1539,8 +1536,10 @@ linker_hints_lookup(const char *path, int pathlen, const char *modname,
bad:
if (hints)
free(hints, M_TEMP);
- if (nd.ni_vp != NULL)
+ if (nd.ni_vp != NULL) {
+ VOP_UNLOCK(nd.ni_vp, 0, td);
vn_close(nd.ni_vp, FREAD, cred, td);
+ }
/*
* If nothing found or hints is absent - fallback to the old
* way by using "kldname[.ko]" as module name.
OpenPOWER on IntegriCloud