Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Jun 2016 14:22:12 +0000 (UTC)
From:      Andriy Gapon <avg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r301273 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201606031422.u53EMClR046949@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606031422.u53EMClR046949>