SUNRPC: kmap() the xdr pages during decode
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 23 Jun 2023 15:43:14 +0000 (11:43 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 23 Aug 2023 19:58:47 +0000 (15:58 -0400)
commit61182c796d74f54ba66d17bac6f516183ec09af2
treed33fc5c105f0b1198f63c6bf0fa7041c18bca164
parent303a78052091c81e9003915c521fdca1c7e117af
SUNRPC: kmap() the xdr pages during decode

If the pages are in HIGHMEM then we need to make sure they're mapped
before trying to read data off of them, otherwise we could end up with a
NULL pointer dereference.

The downside to this is that we need an extra cleanup step at the end of
decode to kunmap() the last page. I introduced an xdr_finish_decode()
function to do this. Right now this function only calls the
unmap_current_page() function, but other generic cleanup steps could be
added in the future if we come across anything else.

Reported-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
include/linux/sunrpc/xdr.h
net/sunrpc/clnt.c
net/sunrpc/svc.c
net/sunrpc/xdr.c