OSDN Git Service

SUNRPC: Fix a client regression when handling oversized replies
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 15 Mar 2019 16:47:34 +0000 (12:47 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Fri, 15 Mar 2019 17:06:21 +0000 (13:06 -0400)
If the server sends a reply that is larger than the pre-allocated
buffer, then the current code may fail to register how much of
the stream that it has finished reading. This again can lead to
hangs.

Fixes: e92053a52e68 ("SUNRPC: Handle zero length fragments correctly")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/xprtsock.c

index 42f45d3..9359539 100644 (file)
@@ -453,7 +453,7 @@ xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags,
                        goto out;
                if (ret != want)
                        goto out;
-       } else
+       } else if (offset < seek_init)
                offset = seek_init;
        ret = -EMSGSIZE;
 out: