SUNRPC: Trap RDMA segment overflows
authorChuck Lever <chuck.lever@oracle.com>
Wed, 1 Jun 2022 16:46:52 +0000 (12:46 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 14 Jun 2022 16:36:16 +0000 (18:36 +0200)
commitea26bf5eca1459b5a7824997d7823409ce38214e
tree353b69ed1cdca681f0caf4c8d8980688e9e0920f
parent7a60594efdd5dbe1b2ece5c38cdcadd0e25cd05e
SUNRPC: Trap RDMA segment overflows

[ Upstream commit f012e95b377c73c0283f009823c633104dedb337 ]

Prevent svc_rdma_build_writes() from walking off the end of a Write
chunk's segment array. Caught with KASAN.

The test that this fix replaces is invalid, and might have been left
over from an earlier prototype of the PCL work.

Fixes: 7a1cbfa18059 ("svcrdma: Use parsed chunk lists to construct RDMA Writes")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/xprtrdma/svc_rdma_rw.c