]> git.baikalelectronics.ru Git - kernel.git/commit
RDMA/rxe: Fix over copying in get_srq_wqe
authorBob Pearson <rpearsonhpe@gmail.com>
Fri, 18 Jun 2021 04:57:41 +0000 (23:57 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 22 Jun 2021 18:38:52 +0000 (15:38 -0300)
commit87cb59050fee097f338b2ef1c94a85e24f230c66
treeb9285d2087845262335b5c24854eded11ec4cae7
parentfb8777f8cbebe67466dee234ed336076d8f3e57f
RDMA/rxe: Fix over copying in get_srq_wqe

Currently get_srq_wqe() in rxe_resp.c copies the maximum possible number
of bytes from the wqe into the QPs copy of the SRQ wqe. This is usually
extra work and risks reading past the end of the SRQ circular buffer if
the SRQ is configured with less than the maximum possible number of SGEs.

Check the number of SGEs is not too large.
Compute the actual number of bytes in the WR and copy only those.

Fixes: c4397c211d7d ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20210618045742.204195-5-rpearsonhpe@gmail.com
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_resp.c