PERFORCE change 45391 for review
Robert Watson
rwatson at FreeBSD.org
Thu Jan 15 16:27:19 GMT 2004
http://perforce.freebsd.org/chv.cgi?CH=45391
Change 45391 by rwatson at rwatson_tislabs on 2004/01/15 08:26:17
Assert Giant for VFS.
Lock fdp while accessing it to find current/root directories.
Vref the vnodes before releasing the file descriptor lock.
Affected files ...
.. //depot/projects/trustedbsd/audit2/sys/security/audit/bsm_klib.c#9 edit
Differences ...
==== //depot/projects/trustedbsd/audit2/sys/security/audit/bsm_klib.c#9 (text+ko) ====
@@ -729,11 +729,11 @@
struct vnode *vnp;
struct filedesc *fdp;
- /*
- * XXX: file descriptor locking!
- */
+ mtx_assert(&Giant, MA_OWNED);
+
fdp = td->td_proc->p_fd;
bufp = path;
+ FILEDESC_LOCK(fdp);
if (*(path) == '/') {
while (*(bufp) == '/')
bufp++; /* skip leading '/'s */
@@ -746,11 +746,14 @@
bufp--; /* restore one '/' */
} else {
vnp = fdp->fd_rdir; /* use process root */
+ vref(vnp);
}
} else {
vnp = fdp->fd_cdir; /* prepend the current dir */
+ vref(vnp);
bufp = path;
}
+ FILEDESC_UNLOCK(fdp);
if (vnp != NULL) {
/*
* XXX: Should lock vnode!
@@ -765,7 +768,7 @@
vn_lock(vnp, LK_EXCLUSIVE | LK_RETRY, td);
if (vn_fullpath(NULL, vnp, cpath, MAXPATHLEN) != 0)
cpath[0] = '\0';
- VOP_UNLOCK(vnp, 0, td);
+ vput(vnp);
len = strlen(cpath);
strncpy(cpath + len-1, bufp, MAXPATHLEN - len);
} else {
To Unsubscribe: send mail to majordomo at trustedbsd.org
with "unsubscribe trustedbsd-cvs" in the body of the message
More information about the trustedbsd-cvs
mailing list