Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 2 Dec 2019 00:39:58 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r355279 - stable/12/sys/fs/nfsclient
Message-ID:  <201912020039.xB20dwYS059998@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Mon Dec  2 00:39:58 2019
New Revision: 355279
URL: https://svnweb.freebsd.org/changeset/base/355279

Log:
  MFC r355210:
  In nfs_lock(), recheck vp->v_data after lock before accessing it.
  
  PR:	242184

Modified:
  stable/12/sys/fs/nfsclient/nfs_clvnops.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/12/sys/fs/nfsclient/nfs_clvnops.c	Mon Dec  2 00:11:12 2019	(r355278)
+++ stable/12/sys/fs/nfsclient/nfs_clvnops.c	Mon Dec  2 00:39:58 2019	(r355279)
@@ -287,6 +287,8 @@ nfs_lock(struct vop_lock1_args *ap)
 	if (error != 0 || vp->v_op != &newnfs_vnodeops)
 		return (error);
 	np = VTONFS(vp);
+	if (np == NULL)
+		return (0);
 	NFSLOCKNODE(np);
 	if ((np->n_flag & NVNSETSZSKIP) == 0 || (lktype != LK_SHARED &&
 	    lktype != LK_EXCLUSIVE && lktype != LK_UPGRADE &&
@@ -320,6 +322,9 @@ nfs_lock(struct vop_lock1_args *ap)
 		error = VOP_LOCK1_APV(&default_vnodeops, ap);
 		if (error != 0 || vp->v_op != &newnfs_vnodeops)
 			return (error);
+		if (vp->v_data == NULL)
+			goto downgrade;
+		MPASS(vp->v_data == np);
 		NFSLOCKNODE(np);
 		if ((np->n_flag & NVNSETSZSKIP) == 0) {
 			NFSUNLOCKNODE(np);



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