svn commit: r259522 - head/sys/kern
Konstantin Belousov
kib at FreeBSD.org
Tue Dec 17 17:31:16 UTC 2013
Author: kib
Date: Tue Dec 17 17:31:16 2013
New Revision: 259522
URL: http://svnweb.freebsd.org/changeset/base/259522
Log:
If vn_open_vnode() succeeded in opening the vnode, but subsequent
advisory lock cannot be obtained, prevent double-close of the vnode in
vn_close() called from the fdrop(), by resetting file' f_ops methods.
Reported and tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Modified:
head/sys/kern/vfs_vnops.c
Modified: head/sys/kern/vfs_vnops.c
==============================================================================
--- head/sys/kern/vfs_vnops.c Tue Dec 17 17:28:02 2013 (r259521)
+++ head/sys/kern/vfs_vnops.c Tue Dec 17 17:31:16 2013 (r259522)
@@ -313,6 +313,9 @@ vn_open_vnode(struct vnode *vp, int fmod
vn_lock(vp, lock_flags | LK_RETRY);
(void)VOP_CLOSE(vp, fmode, cred, td);
vn_finished_write(mp);
+ /* Prevent second close from fdrop()->vn_close(). */
+ if (fp != NULL)
+ fp->f_ops= &badfileops;
return (error);
}
fp->f_flag |= FHASLOCK;
More information about the svn-src-head
mailing list