RDMA/rxe: Fix incorrect responder length checking
authorBob Pearson <rpearsonhpe@gmail.com>
Thu, 8 Dec 2022 21:09:46 +0000 (15:09 -0600)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 9 Dec 2022 23:26:27 +0000 (19:26 -0400)
commit689c5421bfe0eac65526bd97a466b9590a6aad3c
tree5db3ad5615b1f4a5971fbbaf940744bc3d8efd5b
parent3282a549cf9b300e2d1b007925ed007ab24e4131
RDMA/rxe: Fix incorrect responder length checking

The code in rxe_resp.c at check_length() is incorrect as it compares
pkt->opcode an 8 bit value against various mask bits which are all higher
than 256 so nothing is ever reported.

This patch rewrites this to compare against pkt->mask which is
correct. However this now exposes another error. For UD send packets the
value of the pmtu cannot be determined from qp->mtu.  All that is required
here is to later check if the payload fits into the posted receive buffer
in that case.

Fixes: 837a55847ead ("RDMA/rxe: Implement packet length validation on responder")
Link: https://lore.kernel.org/r/20221208210945.28607-1-rpearsonhpe@gmail.com
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Reviewed-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_resp.c