From 33a80ffc8bdb73a5c14b22b66286f30e6a154831 Mon Sep 17 00:00:00 2001 From: rmacklem Date: Mon, 17 Feb 2020 19:31:34 +0000 Subject: [PATCH] MFC: r357149 Fix a crash in the NFSv4 server. The PR reported a crash that occurred when a file was removed while client(s) were actively doing lock operations on it. Since nfsvno_getvp() will return NULL when the file does not exist, the bug was obvious and easy to fix via this patch. It is a little surprising that this wasn't found sooner, but I guess the above case rarely occurs. PR: 242768 git-svn-id: svn://svn.freebsd.org/base/stable/10@358035 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/fs/nfsserver/nfs_nfsdstate.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfsserver/nfs_nfsdstate.c b/sys/fs/nfsserver/nfs_nfsdstate.c index b4ec70f4c..56c33cab5 100644 --- a/sys/fs/nfsserver/nfs_nfsdstate.c +++ b/sys/fs/nfsserver/nfs_nfsdstate.c @@ -1488,7 +1488,8 @@ nfsrv_freeallnfslocks(struct nfsstate *stp, vnode_t vp, int cansleep, tvp = NULL; else if (vp == NULL && cansleep != 0) { tvp = nfsvno_getvp(&lfp->lf_fh); - NFSVOPUNLOCK(tvp, 0); + if (tvp != NULL) + NFSVOPUNLOCK(tvp, 0); } else tvp = vp; gottvp = 1; -- 2.42.0