]> git.hungrycats.org Git - linux/commitdiff
[PATCH] Fix bug in svc_udp_recvfrom
authorNeil Brown <neilb@cse.unsw.edu.au>
Thu, 21 Nov 2002 06:44:51 +0000 (22:44 -0800)
committerLinus Torvalds <torvalds@penguin.transmeta.com>
Thu, 21 Nov 2002 06:44:51 +0000 (22:44 -0800)
 Hirokazu Takahashi <taka@valinux.co.jp> noticed that
 svc_udp_recvfrom wouild set some fields in rqstp->rq_arg
 wrongly if the request was shorter than one page.
 This patch makes the code in udp_recvfrom the same
 as the (correct) code in tcp_recvfrom.

net/sunrpc/svcsock.c

index 90776859b760e0f9f1a184f2c73995c5b6f1a13b..6b455b1b13a9cb4242d09df7a07597e4a526a440 100644 (file)
@@ -574,8 +574,14 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
 
 
        rqstp->rq_arg.len = len;
-       rqstp->rq_arg.page_len = len - rqstp->rq_arg.head[0].iov_len;
-       rqstp->rq_argused += (rqstp->rq_arg.page_len + PAGE_SIZE - 1)/ PAGE_SIZE;
+       rqstp->rq_arg.page_base = 0;
+       if (len <= rqstp->rq_arg.head[0].iov_len) {
+               rqstp->rq_arg.head[0].iov_len = len;
+               rqstp->rq_arg.page_len = 0;
+       } else {
+               rqstp->rq_arg.page_len = len - rqstp->rq_arg.head[0].iov_len;
+               rqstp->rq_argused += (rqstp->rq_arg.page_len + PAGE_SIZE - 1)/ PAGE_SIZE;
+       }
        rqstp->rq_prot        = IPPROTO_UDP;
 
        /* Get sender address */