RDMA/rxe: Make responder handle RDMA Read failures
authorDaisuke Matsuda <matsuda-daisuke@fujitsu.com>
Thu, 13 Oct 2022 01:47:23 +0000 (10:47 +0900)
committerLeon Romanovsky <leon@kernel.org>
Tue, 25 Oct 2022 05:56:32 +0000 (08:56 +0300)
Currently, responder can reply packets with invalid payloads if it fails
to copy messages to the packets. Add an error handling in read_reply() to
inform a requesting node of the failure.

Link: https://lore.kernel.org/r/20221013014724.3786212-1-matsuda-daisuke@fujitsu.com
Suggested-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/infiniband/sw/rxe/rxe_resp.c

index ed5a09e..82b74e9 100644 (file)
@@ -809,10 +809,14 @@ static enum resp_states read_reply(struct rxe_qp *qp,
        if (!skb)
                return RESPST_ERR_RNR;
 
-       rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
-                   payload, RXE_FROM_MR_OBJ);
+       err = rxe_mr_copy(mr, res->read.va, payload_addr(&ack_pkt),
+                         payload, RXE_FROM_MR_OBJ);
        if (mr)
                rxe_put(mr);
+       if (err) {
+               kfree_skb(skb);
+               return RESPST_ERR_RKEY_VIOLATION;
+       }
 
        if (bth_pad(&ack_pkt)) {
                u8 *pad = payload_addr(&ack_pkt) + payload;