svn commit: r261062 - stable/9/sys/rpc

Alexander Motin mav at FreeBSD.org
Thu Jan 23 00:42:56 UTC 2014


Author: mav
Date: Thu Jan 23 00:42:55 2014
New Revision: 261062
URL: http://svnweb.freebsd.org/changeset/base/261062

Log:
  MFC r259828:
  Fix a bug introduced at r259632, triggering infinite loop in some cases.

Modified:
  stable/9/sys/rpc/svc_vc.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/sys/   (props changed)

Modified: stable/9/sys/rpc/svc_vc.c
==============================================================================
--- stable/9/sys/rpc/svc_vc.c	Thu Jan 23 00:42:08 2014	(r261061)
+++ stable/9/sys/rpc/svc_vc.c	Thu Jan 23 00:42:55 2014	(r261062)
@@ -555,7 +555,7 @@ svc_vc_backchannel_stat(SVCXPRT *xprt)
  * leaving the result in cd->mreq. If we don't have a complete record, leave
  * the partial result in cd->mreq and try to read more from the socket.
  */
-static void
+static int
 svc_vc_process_pending(SVCXPRT *xprt)
 {
 	struct cf_conn *cd = (struct cf_conn *) xprt->xp_p1;
@@ -584,7 +584,7 @@ svc_vc_process_pending(SVCXPRT *xprt)
 		}
 		if (n < sizeof(uint32_t)) {
 			so->so_rcv.sb_lowat = sizeof(uint32_t) - n;
-			return;
+			return (FALSE);
 		}
 		m_copydata(cd->mpending, 0, sizeof(header),
 		    (char *)&header);
@@ -620,6 +620,7 @@ svc_vc_process_pending(SVCXPRT *xprt)
 	}
 
 	so->so_rcv.sb_lowat = imax(1, imin(cd->resid, so->so_rcv.sb_hiwat / 2));
+	return (TRUE);
 }
 
 static bool_t
@@ -642,8 +643,10 @@ svc_vc_recv(SVCXPRT *xprt, struct rpc_ms
 	for (;;) {
 		/* If we have no request ready, check pending queue. */
 		while (cd->mpending &&
-		    (cd->mreq == NULL || cd->resid != 0 || !cd->eor))
-			svc_vc_process_pending(xprt);
+		    (cd->mreq == NULL || cd->resid != 0 || !cd->eor)) {
+			if (!svc_vc_process_pending(xprt))
+				break;
+		}
 
 		/* Process and return complete request in cd->mreq. */
 		if (cd->mreq != NULL && cd->resid == 0 && cd->eor) {


More information about the svn-src-stable-9 mailing list