Author: emaste
Date: Fri Nov 23 20:31:27 2018
New Revision: 340850
URL: https://svnweb.freebsd.org/changeset/base/340850

Log:
  MFC r340662 (rmacklem):
  
  nfsm_advance() would panic() when the offs argument was negative.
  The code assumed that this would indicate a corrupted mbuf chain, but
  it could simply be caused by bogus RPC message data.
  This patch replaces the panic() with a printf() plus error return.

Modified:
  stable/12/sys/fs/nfs/nfs_commonsubs.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfs/nfs_commonsubs.c
==============================================================================
--- stable/12/sys/fs/nfs/nfs_commonsubs.c       Fri Nov 23 20:29:47 2018        
(r340849)
+++ stable/12/sys/fs/nfs/nfs_commonsubs.c       Fri Nov 23 20:31:27 2018        
(r340850)
@@ -725,10 +725,14 @@ nfsm_advance(struct nfsrv_descript *nd, int offs, int 
        if (offs == 0)
                goto out;
        /*
-        * A negative offs should be considered a serious problem.
+        * A negative offs might indicate a corrupted mbuf chain and,
+        * as such, a printf is logged.
         */
-       if (offs < 0)
-               panic("nfsrv_advance");
+       if (offs < 0) {
+               printf("nfsrv_advance: negative offs\n");
+               error = EBADRPC;
+               goto out;
+       }
 
        /*
         * If left == -1, calculate it here.
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to