From 842832aeae5b74143652b2aba03b1d277a84397e Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Fri, 24 Oct 2008 16:04:10 +0000 Subject: [PATCH] Don't rely on the value of *statep without first taking the vnode interlock. Reviewed by: Mike Tancsa MFC after: 2 weeks --- sys/kern/kern_lockf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c index 130e0b91ec92..2e1510d2f306 100644 --- a/sys/kern/kern_lockf.c +++ b/sys/kern/kern_lockf.c @@ -467,12 +467,15 @@ lf_advlockasync(struct vop_advlockasync_args *ap, struct lockf **statep, /* * Avoid the common case of unlocking when inode has no locks. */ - if ((*statep) == NULL || LIST_EMPTY(&(*statep)->ls_active)) { + VI_LOCK(vp); + if ((*statep) == NULL) { if (ap->a_op != F_SETLK) { fl->l_type = F_UNLCK; + VI_UNLOCK(vp); return (0); } } + VI_UNLOCK(vp); /* * Map our arguments to an existing lock owner or create one