On 13/10/2022 09:47, Daisuke Matsuda wrote:
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.
Suggested-by: Li Zhijian <lizhijian@xxxxxxxxxxx>
Signed-off-by: Daisuke Matsuda <matsuda-daisuke@xxxxxxxxxxx>
Reviewed-by: Li Zhijian <lizhijian@xxxxxxxxxxx>
thx
Zhijian
---
FOR REVIEWERS:
I referred to IB Specification Vol 1-Revision-1.5 to make this patch.
Please see Ch.9.7.5.2.4, Ch.9.7.4.1.5 and Ch.9.7.5.1.3.
drivers/infiniband/sw/rxe/rxe_resp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c
index ed5a09e86417..82b74e926e09 100644
--- a/drivers/infiniband/sw/rxe/rxe_resp.c
+++ b/drivers/infiniband/sw/rxe/rxe_resp.c
@@ -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;