Author: rmacklem
Date: Sun Jan 26 17:59:05 2020
New Revision: 357149
URL: https://svnweb.freebsd.org/changeset/base/357149

Log:
  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.
  
  Tested by:    iron.ud...@gmail.com
  PR:           242768
  Reported by:  iron.ud...@gmail.com
  MFC after:    2 weeks

Modified:
  head/sys/fs/nfsserver/nfs_nfsdstate.c

Modified: head/sys/fs/nfsserver/nfs_nfsdstate.c
==============================================================================
--- head/sys/fs/nfsserver/nfs_nfsdstate.c       Sun Jan 26 17:22:05 2020        
(r357148)
+++ head/sys/fs/nfsserver/nfs_nfsdstate.c       Sun Jan 26 17:59:05 2020        
(r357149)
@@ -1554,7 +1554,8 @@ nfsrv_freeallnfslocks(struct nfsstate *stp, vnode_t vp
                                tvp = NULL;
                        else if (vp == NULL && cansleep != 0) {
                                tvp = nfsvno_getvp(&lfp->lf_fh);
-                               NFSVOPUNLOCK(tvp);
+                               if (tvp != NULL)
+                                       NFSVOPUNLOCK(tvp);
                        } else
                                tvp = vp;
                        gottvp = 1;
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to