aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svcsock.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-12-03 16:30:42 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-12-04 07:47:58 -0500
commitad46ccf09440975618e8fc1ead53d0a27b9bcf4c (patch)
tree8f37c936d4753dc815fdc6d47f0ee240621b9736 /net/sunrpc/svcsock.c
parentcc248d4b1ddf05fefc1373d9d7a4dd1df71b6190 (diff)
svcrpc: delay minimum-rpc-size check till later
Soon we want to support multiple fragments, in which case it may be legal for a single fragment to be smaller than 8 bytes, so we'll want to delay this check till we've reached the last fragment. Also fix an outdated comment. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/svcsock.c')
-rw-r--r--net/sunrpc/svcsock.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index d50de2b95036..15571790dc9e 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -921,10 +921,8 @@ out:
921} 921}
922 922
923/* 923/*
924 * Receive data. 924 * Receive fragment record header.
925 * If we haven't gotten the record length yet, get the next four bytes. 925 * If we haven't gotten the record length yet, get the next four bytes.
926 * Otherwise try to gobble up as much as possible up to the complete
927 * record length.
928 */ 926 */
929static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp) 927static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp)
930{ 928{
@@ -968,9 +966,6 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp)
968 } 966 }
969 } 967 }
970 968
971 if (svc_sock_reclen(svsk) < 8)
972 goto err_delete; /* client is nuts. */
973
974 return svc_sock_reclen(svsk); 969 return svc_sock_reclen(svsk);
975error: 970error:
976 dprintk("RPC: TCP recv_record got %d\n", len); 971 dprintk("RPC: TCP recv_record got %d\n", len);
@@ -1076,12 +1071,15 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
1076 if (len != want) { 1071 if (len != want) {
1077 svc_tcp_save_pages(svsk, rqstp); 1072 svc_tcp_save_pages(svsk, rqstp);
1078 if (len < 0 && len != -EAGAIN) 1073 if (len < 0 && len != -EAGAIN)
1079 goto err_other; 1074 goto err_delete;
1080 dprintk("svc: incomplete TCP record (%d of %d)\n", 1075 dprintk("svc: incomplete TCP record (%d of %d)\n",
1081 svsk->sk_tcplen, svc_sock_reclen(svsk)); 1076 svsk->sk_tcplen, svc_sock_reclen(svsk));
1082 goto err_noclose; 1077 goto err_noclose;
1083 } 1078 }
1084 1079
1080 if (svc_sock_reclen(svsk) < 8)
1081 goto err_delete; /* client is nuts. */
1082
1085 rqstp->rq_arg.len = svc_sock_reclen(svsk); 1083 rqstp->rq_arg.len = svc_sock_reclen(svsk);
1086 rqstp->rq_arg.page_base = 0; 1084 rqstp->rq_arg.page_base = 0;
1087 if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len) { 1085 if (rqstp->rq_arg.len <= rqstp->rq_arg.head[0].iov_len) {
@@ -1117,10 +1115,10 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
1117 1115
1118error: 1116error:
1119 if (len != -EAGAIN) 1117 if (len != -EAGAIN)
1120 goto err_other; 1118 goto err_delete;
1121 dprintk("RPC: TCP recvfrom got EAGAIN\n"); 1119 dprintk("RPC: TCP recvfrom got EAGAIN\n");
1122 return 0; 1120 return 0;
1123err_other: 1121err_delete:
1124 printk(KERN_NOTICE "%s: recvfrom returned errno %d\n", 1122 printk(KERN_NOTICE "%s: recvfrom returned errno %d\n",
1125 svsk->sk_xprt.xpt_server->sv_name, -len); 1123 svsk->sk_xprt.xpt_server->sv_name, -len);
1126 set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags); 1124 set_bit(XPT_CLOSE, &svsk->sk_xprt.xpt_flags);