diff mbox series

[1/2] RDMA/rxe: Make responder handle RDMA Read failures

Message ID 20221013014724.3786212-1-matsuda-daisuke@fujitsu.com (mailing list archive)
State Accepted
Delegated to: Jason Gunthorpe
Headers show
Series [1/2] RDMA/rxe: Make responder handle RDMA Read failures | expand

Commit Message

Daisuke Matsuda (Fujitsu) Oct. 13, 2022, 1:47 a.m. UTC
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@fujitsu.com>
Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
---
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(-)

Comments

Li Zhijian Oct. 13, 2022, 4:14 a.m. UTC | #1
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@fujitsu.com>
> Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>

Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>

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;
Jason Gunthorpe Oct. 24, 2022, 5:10 p.m. UTC | #2
On Thu, Oct 13, 2022 at 10:47:23AM +0900, 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@fujitsu.com>
> Signed-off-by: Daisuke Matsuda <matsuda-daisuke@fujitsu.com>
> Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
> ---
> 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(-)

Both applied to for-next

Thanks,
Jason
diff mbox series

Patch

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;