Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Sep 2005 11:04:16 GMT
From:      Robert Watson <rwatson@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 84046 for review
Message-ID:  <200509211104.j8LB4Gt2040949@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=84046

Change 84046 by rwatson@rwatson_zoo on 2005/09/21 11:03:31

	In audit_sysclose(), optionally lock and unlock Giant, and always
	lock and unlock the vnode when auditing vnode information.

Affected files ...

.. //depot/projects/trustedbsd/audit3/sys/security/audit/kern_audit.c#33 edit

Differences ...

==== //depot/projects/trustedbsd/audit3/sys/security/audit/kern_audit.c#33 (text+ko) ====

@@ -2452,14 +2452,21 @@
 void
 audit_sysclose(struct thread *td, int fd)
 {
+	struct vnode *vp;
 	struct file *fp;
+	int vfslocked;
 
 	audit_arg_fd(fd);
 
 	if (getvnode(td->td_proc->p_fd, fd, &fp) != 0)
 		return;
 
-	audit_arg_vnpath((struct vnode *)fp->f_vnode, ARG_VNODE1);
+	vp = fp->f_vnode;
+	vfslocked = VFS_LOCK_GIANT(vp->v_mount);
+	vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
+	audit_arg_vnpath(vp, ARG_VNODE1);
+	VOP_UNLOCK(vp, 0, td);
+	VFS_UNLOCK_GIANT(vfslocked);
 	fdrop(fp, td);
 } 
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200509211104.j8LB4Gt2040949>