]> git.hungrycats.org Git - linux/commitdiff
[PATCH] PATCH - RPC/TCP 4 of 4 - Handle short read when reading RPC/TCP packet length
authorNeil Brown <neilb@cse.unsw.edu.au>
Tue, 13 Aug 2002 00:48:53 +0000 (17:48 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Tue, 13 Aug 2002 00:48:53 +0000 (17:48 -0700)
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.

net/sunrpc/svcsock.c

index ea15fcb2648e21a01511f60b9b3b8afe3b5783bf..ab28937c1dcd268c22204413f822cbf1fa015ace 100644 (file)
@@ -811,6 +811,9 @@ svc_tcp_recvfrom(struct svc_rqst *rqstp)
                        goto error;
                svsk->sk_tcplen += len;
 
+               if (len < want)
+                       return 0;
+
                svsk->sk_reclen = ntohl(svsk->sk_reclen);
                if (!(svsk->sk_reclen & 0x80000000)) {
                        /* FIXME: technically, a record can be fragmented,