diff options
author | dfr <dfr@FreeBSD.org> | 2008-10-24 16:04:10 +0000 |
---|---|---|
committer | dfr <dfr@FreeBSD.org> | 2008-10-24 16:04:10 +0000 |
commit | f98e1f1bbf7243801ebb0a245a86494b714aa49a (patch) | |
tree | 1b47f7dbd3400d6f60996e06368e7f75bb35c0a2 /sys/kern | |
parent | 788640b731ab28f45d3996346a127ffafa83ae71 (diff) | |
download | FreeBSD-src-f98e1f1bbf7243801ebb0a245a86494b714aa49a.zip FreeBSD-src-f98e1f1bbf7243801ebb0a245a86494b714aa49a.tar.gz |
Don't rely on the value of *statep without first taking the vnode interlock.
Reviewed by: Mike Tancsa
MFC after: 2 weeks
Diffstat (limited to 'sys/kern')
-rw-r--r-- | sys/kern/kern_lockf.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/kern/kern_lockf.c b/sys/kern/kern_lockf.c index 130e0b9..2e1510d 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 |