Date: Sat, 13 May 2006 04:28:54 GMT From: Robert Watson <rwatson@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 97068 for review Message-ID: <200605130428.k4D4SsOY044266@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=97068 Change 97068 by rwatson@rwatson_fledge on 2006/05/13 04:27:53 Remove use of Giant around vn_open() in audit code. Submitted by: jhb Affected files ... .. //depot/projects/trustedbsd/audit3/sys/security/audit/audit_syscalls.c#14 edit Differences ... ==== //depot/projects/trustedbsd/audit3/sys/security/audit/audit_syscalls.c#14 (text+ko) ==== @@ -525,7 +525,7 @@ struct ucred *cred; struct vnode *vp; int error = 0; - int flags; + int flags, vfslocked; error = suser(td); if (error) @@ -544,25 +544,21 @@ if (uap->path == NULL) return (EINVAL); - /* - * XXXAUDIT: Giant may no longer be required here. - */ - mtx_lock(&Giant); - NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF | MPSAFE, UIO_USERSPACE, + uap->path, td); flags = AUDIT_OPEN_FLAGS; error = vn_open(&nd, &flags, 0, -1); - if (error) { - mtx_unlock(&Giant); - goto err_out; - } + if (error) + return (error); + vfslocked = NDHASGIANT(&nd); VOP_UNLOCK(nd.ni_vp, 0, td); vp = nd.ni_vp; if (vp->v_type != VREG) { vn_close(vp, AUDIT_CLOSE_FLAGS, td->td_ucred, td); - mtx_unlock(&Giant); - error = EINVAL; - goto err_out; + VFS_UNLOCK_GIANT(vfslocked); + return (EINVAL); } + VFS_UNLOCK_GIANT(vfslocked); cred = td->td_ucred; crhold(cred); @@ -572,10 +568,8 @@ */ audit_suspended = 0; - mtx_unlock(&Giant); audit_rotate_vnode(cred, vp); -err_out: return (error); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200605130428.k4D4SsOY044266>