]> git.baikalelectronics.ru Git - kernel.git/commit
sunrpc: Avoid a KASAN slab-out-of-bounds bug in xdr_set_page_base()
authorAnna Schumaker <Anna.Schumaker@Netapp.com>
Wed, 9 Jun 2021 21:07:29 +0000 (17:07 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Sun, 13 Jun 2021 23:36:49 +0000 (19:36 -0400)
commit3fb0a46ac40feb4ffc4634e2feded9a0e1ea2f3a
tree5a22e9bd5f084e960186b8f370b8064452ca4a83
parent923ede353547fcd4fe4ce59012d073133633ad92
sunrpc: Avoid a KASAN slab-out-of-bounds bug in xdr_set_page_base()

This seems to happen fairly easily during READ_PLUS testing on NFS v4.2.
I found that we could end up accessing xdr->buf->pages[pgnr] with a pgnr
greater than the number of pages in the array. So let's just return
early if we're setting base to a point at the end of the page data and
let xdr_set_tail_base() handle setting up the buffer pointers instead.

Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Fixes: 99be78ff9be0 ("SUNRPC: Clean up helpers xdr_set_iov() and xdr_set_page_base()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
net/sunrpc/xdr.c