Commit dfc3997c authored by Neil Brown's avatar Neil Brown Committed by Linus Torvalds

[PATCH] PATCH - RPC/TCP 4 of 4 - Handle short read when reading RPC/TCP packet length

The code already copes with the possibility of having
read some of the 4byte length but not all, but can never
get into that situation.  We just need to add a 'return'
for the case where read got some data but not enough.
Either 0 or -EAGAIN could be returned, they both have the
same effect.
parent d5300a3a
...@@ -811,6 +811,9 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp) ...@@ -811,6 +811,9 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
goto error; goto error;
svsk->sk_tcplen += len; svsk->sk_tcplen += len;
if (len < want)
return 0;
svsk->sk_reclen = ntohl(svsk->sk_reclen); svsk->sk_reclen = ntohl(svsk->sk_reclen);
if (!(svsk->sk_reclen & 0x80000000)) { if (!(svsk->sk_reclen & 0x80000000)) {
/* FIXME: technically, a record can be fragmented, /* FIXME: technically, a record can be fragmented,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment