svn commit: r301273 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs

Andriy Gapon avg at FreeBSD.org
Fri Jun 3 14:22:13 UTC 2016


Author: avg
Date: Fri Jun  3 14:22:12 2016
New Revision: 301273
URL: https://svnweb.freebsd.org/changeset/base/301273

Log:
  zfs_root: fix a potential root vnode reference leak
  
  It could happen in an unlikely case that we fail to lock the root vnode
  with requested flags (which appear to never include LK_NOWAIT).
  
  MFC after:	1 week

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Fri Jun  3 14:14:55 2016	(r301272)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c	Fri Jun  3 14:22:12 2016	(r301273)
@@ -1780,11 +1780,13 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t
 
 	ZFS_EXIT(zfsvfs);
 
-	if (error == 0)
+	if (error == 0) {
 		error = vn_lock(*vpp, flags);
-	if (error != 0)
-		*vpp = NULL;
-
+		if (error != 0) {
+			VN_RELE(*vpp);
+			*vpp = NULL;
+		}
+	}
 	return (error);
 }
 


More information about the svn-src-head mailing list