]> git.baikalelectronics.ru Git - kernel.git/commit
SUNRPC: Fix svcxdr_init_encode's buflen calculation
authorChuck Lever <chuck.lever@oracle.com>
Thu, 1 Sep 2022 19:09:59 +0000 (15:09 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 26 Sep 2022 18:02:26 +0000 (14:02 -0400)
commit963b751ca7af8f6fa3afb7a5dada7b0d3b4933b6
tree0b6ec5907606e0c5607c204e47658c62838ff275
parent6b4a070f76328e7ad42ad73761969f9d170d2909
SUNRPC: Fix svcxdr_init_encode's buflen calculation

Commit 0f08a2d9e59f ("nfsd4: allow encoding across page boundaries")
added an explicit computation of the remaining length in the rq_res
XDR buffer.

The computation appears to suffer from an "off-by-one" bug. Because
buflen is too large by one page, XDR encoding can run off the end of
the send buffer by eventually trying to use the struct page address
in rq_page_end, which always contains NULL.

Fixes: 1d5214d2d303 ("NFSD: Extract the svcxdr_init_encode() helper")
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/svc.h