Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 252810
b: refs/heads/master
c: cc6c212
h: refs/heads/master
v: v3
  • Loading branch information
J. Bruce Fields committed Apr 7, 2011
1 parent 6fa024d commit 72dd319
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 48e6555c7b3bf0d92f8167d8b8b8ecf4a3fdab84
refs/heads/master: cc6c2127f2316c2b2ad1e8919b45cde5e03f65aa
21 changes: 7 additions & 14 deletions trunk/net/sunrpc/svcsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,9 @@ static int svc_tcp_recv_record(struct svc_sock *svsk, struct svc_rqst *rqstp)
}
}

if (svsk->sk_reclen < 8)
goto err_delete; /* client is nuts. */

/* Check whether enough data is available */
len = svc_recv_available(svsk);
if (len < 0)
Expand Down Expand Up @@ -1058,20 +1061,10 @@ static int svc_tcp_recvfrom(struct svc_rqst *rqstp)
vec[0] = rqstp->rq_arg.head[0];
vlen = PAGE_SIZE;

/*
* We have enough data for the whole tcp record. Let's try and read the
* first 8 bytes to get the xid and the call direction. We can use this
* to figure out if this is a call or a reply to a callback. If
* sk_reclen is < 8 (xid and calldir), then this is a malformed packet.
* In that case, don't bother with the calldir and just read the data.
* It will be rejected in svc_process.
*/
if (len >= 8) {
len = svc_process_calldir(svsk, rqstp, &req, vec);
if (len < 0)
goto err_again;
vlen -= 8;
}
len = svc_process_calldir(svsk, rqstp, &req, vec);
if (len < 0)
goto err_again;
vlen -= 8;

pnum = 1;
while (vlen < svsk->sk_reclen - 8) {
Expand Down

0 comments on commit 72dd319

Please sign in to comment.