Date: Thu, 15 Jan 2004 08:27:19 -0800 (PST) From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 45391 for review Message-ID: <200401151627.i0FGRJNa099452@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=45391 Change 45391 by rwatson@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 {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200401151627.i0FGRJNa099452>
