summaryrefslogtreecommitdiffstats
path: root/sys/rpc
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2014-01-22 23:48:54 +0000
committermav <mav@FreeBSD.org>2014-01-22 23:48:54 +0000
commit28a527f07e1aac50c150d6b9ec63ec96beb9444a (patch)
tree651fe4197473878f7bfc9da737bf23038392b7e7 /sys/rpc
parentbdd6d3eac30a1b1bc1a64aa98b935921e5cef1c6 (diff)
downloadFreeBSD-src-28a527f07e1aac50c150d6b9ec63ec96beb9444a.zip
FreeBSD-src-28a527f07e1aac50c150d6b9ec63ec96beb9444a.tar.gz
MFC r259828:
Fix a bug introduced at r259632, triggering infinite loop in some cases.
Diffstat (limited to 'sys/rpc')
-rw-r--r--sys/rpc/svc_vc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/rpc/svc_vc.c b/sys/rpc/svc_vc.c
index 0adb3fd..988b487 100644
--- a/sys/rpc/svc_vc.c
+++ b/sys/rpc/svc_vc.c
@@ -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_msg *msg,
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) {
OpenPOWER on IntegriCloud