Skip to content

Commit 5131496

Browse files
author
Trond Myklebust
committed
SUNRPC: Fix the minimal size for reply buffer allocation
We must at minimum allocate enough memory to be able to see any auth errors in the reply from the server. Fixes: 2c94b8e ("SUNRPC: Use au_rslack when computing reply...") Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
1 parent 9734ad5 commit 5131496

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

net/sunrpc/clnt.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1730,7 +1730,12 @@ call_allocate(struct rpc_task *task)
17301730
req->rq_callsize = RPC_CALLHDRSIZE + (auth->au_cslack << 1) +
17311731
proc->p_arglen;
17321732
req->rq_callsize <<= 2;
1733-
req->rq_rcvsize = RPC_REPHDRSIZE + auth->au_rslack + proc->p_replen;
1733+
/*
1734+
* Note: the reply buffer must at minimum allocate enough space
1735+
* for the 'struct accepted_reply' from RFC5531.
1736+
*/
1737+
req->rq_rcvsize = RPC_REPHDRSIZE + auth->au_rslack + \
1738+
max_t(size_t, proc->p_replen, 2);
17341739
req->rq_rcvsize <<= 2;
17351740

17361741
status = xprt->ops->buf_alloc(task);

0 commit comments

Comments
 (0)