Acquire vnode lock around call to VOP_GETATTR() in audit_record_write().

In the future, we may want to acquire the lock early in the function and
hold it across calls to vn_rdwr(), etc, to avoid multiple acquires.

Spotted by:	kris (bugmagnet)
Obtained from:	TrustedBSD Project
This commit is contained in:
rwatson 2006-02-07 23:44:31 +00:00
parent f63c104013
commit 93a12ad07f

View File

@ -282,7 +282,9 @@ audit_record_write(struct vnode *vp, struct kaudit_record *ar,
if (ret)
goto out;
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td);
ret = VOP_GETATTR(vp, &vattr, cred, td);
VOP_UNLOCK(vp, 0, td);
if (ret)
goto out;