From a7f18116c2d3337d313eb0ea7ecbc62ec7870123 Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Tue, 7 Feb 2006 23:44:31 +0000 Subject: [PATCH] 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 --- sys/security/audit/audit.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sys/security/audit/audit.c b/sys/security/audit/audit.c index 3ddad11eb554..bc3a795b8758 100644 --- a/sys/security/audit/audit.c +++ b/sys/security/audit/audit.c @@ -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;