stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] RDMA/rxe: Set wqe->status correctly if an unexpected response is received
@ 2018-06-26 15:39 Bart Van Assche
  2018-06-27 16:31 ` Yuval Shaia
  2018-08-08 15:58 ` Jason Gunthorpe
  0 siblings, 2 replies; 6+ messages in thread
From: Bart Van Assche @ 2018-06-26 15:39 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: Doug Ledford, linux-rdma, Bart Van Assche, Zhu Yanjun,
	Jianchao Wang, Yuval Shaia, stable

Every function that returns COMPST_ERROR must set wqe->status to
another value than IB_WC_SUCCESS before returning COMPST_ERROR. Fix
the only code path for which this is not yet the case.

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
Cc: Zhu Yanjun <yanjun.zhu@oracle.com>
Cc: Jianchao Wang <jianchao.w.wang@oracle.com>
Cc: Yuval Shaia <yuval.shaia@oracle.com>
Cc: <stable@vger.kernel.org>
---

Changes compared to v1: left out a pr_err() statement as requested by Jason.

 drivers/infiniband/sw/rxe/rxe_comp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c
index 98d470d1f3fc..83311dd07019 100644
--- a/drivers/infiniband/sw/rxe/rxe_comp.c
+++ b/drivers/infiniband/sw/rxe/rxe_comp.c
@@ -276,6 +276,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp,
 	case IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE:
 		if (wqe->wr.opcode != IB_WR_RDMA_READ &&
 		    wqe->wr.opcode != IB_WR_RDMA_READ_WITH_INV) {
+			wqe->status = IB_WC_FATAL_ERR;
 			return COMPST_ERROR;
 		}
 		reset_retry_counters(qp);
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] RDMA/rxe: Set wqe->status correctly if an unexpected response is received
  2018-06-26 15:39 [PATCH v2] RDMA/rxe: Set wqe->status correctly if an unexpected response is received Bart Van Assche
@ 2018-06-27 16:31 ` Yuval Shaia
  2018-06-27 16:41   ` Bart Van Assche
  2018-08-08 15:58 ` Jason Gunthorpe
  1 sibling, 1 reply; 6+ messages in thread
From: Yuval Shaia @ 2018-06-27 16:31 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Jason Gunthorpe, Doug Ledford, linux-rdma, Zhu Yanjun,
	Jianchao Wang, stable

On Tue, Jun 26, 2018 at 08:39:36AM -0700, Bart Van Assche wrote:
> Every function that returns COMPST_ERROR must set wqe->status to
> another value than IB_WC_SUCCESS before returning COMPST_ERROR. Fix
> the only code path for which this is not yet the case.

It is unclear to me why other places left out from this fix (e.x. lines
248, 288 etc).

> 
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Zhu Yanjun <yanjun.zhu@oracle.com>
> Cc: Jianchao Wang <jianchao.w.wang@oracle.com>
> Cc: Yuval Shaia <yuval.shaia@oracle.com>
> Cc: <stable@vger.kernel.org>
> ---
> 
> Changes compared to v1: left out a pr_err() statement as requested by Jason.
> 
>  drivers/infiniband/sw/rxe/rxe_comp.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/infiniband/sw/rxe/rxe_comp.c b/drivers/infiniband/sw/rxe/rxe_comp.c
> index 98d470d1f3fc..83311dd07019 100644
> --- a/drivers/infiniband/sw/rxe/rxe_comp.c
> +++ b/drivers/infiniband/sw/rxe/rxe_comp.c
> @@ -276,6 +276,7 @@ static inline enum comp_state check_ack(struct rxe_qp *qp,
>  	case IB_OPCODE_RC_RDMA_READ_RESPONSE_MIDDLE:
>  		if (wqe->wr.opcode != IB_WR_RDMA_READ &&
>  		    wqe->wr.opcode != IB_WR_RDMA_READ_WITH_INV) {
> +			wqe->status = IB_WC_FATAL_ERR;
>  			return COMPST_ERROR;
>  		}
>  		reset_retry_counters(qp);
> -- 
> 2.17.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] RDMA/rxe: Set wqe->status correctly if an unexpected response is received
  2018-06-27 16:31 ` Yuval Shaia
@ 2018-06-27 16:41   ` Bart Van Assche
  2018-06-28  8:58     ` Moni Shoua
  0 siblings, 1 reply; 6+ messages in thread
From: Bart Van Assche @ 2018-06-27 16:41 UTC (permalink / raw)
  To: Yuval Shaia
  Cc: Jason Gunthorpe, Doug Ledford, linux-rdma@vger.kernel.org,
	Zhu Yanjun, Jianchao Wang, stable@vger.kernel.org

On 06/27/18 09:32, Yuval Shaia wrote:
> On Tue, Jun 26, 2018 at 08:39:36AM -0700, Bart Van Assche wrote:
>> Every function that returns COMPST_ERROR must set wqe->status to
>> another value than IB_WC_SUCCESS before returning COMPST_ERROR. Fix
>> the only code path for which this is not yet the case.
> 
> It is unclear to me why other places left out from this fix (e.x. lines
> 248, 288 etc).

Hello Yuval,

wqe->status is already set before the code that you mentioned has been 
reached.

Bart.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] RDMA/rxe: Set wqe->status correctly if an unexpected response is received
  2018-06-27 16:41   ` Bart Van Assche
@ 2018-06-28  8:58     ` Moni Shoua
  2018-06-28 15:47       ` Bart Van Assche
  0 siblings, 1 reply; 6+ messages in thread
From: Moni Shoua @ 2018-06-28  8:58 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Yuval Shaia, Jason Gunthorpe, Doug Ledford, linux-rdma,
	yanjun.zhu, jianchao.w.wang, stable

>
> wqe->status is already set before the code that you mentioned has been
> reached.
can you be more specific?
for instance I didn't find similar behavior for the example below
(also in check_ack())

        case IB_OPCODE_RC_ATOMIC_ACKNOWLEDGE:
                syn = aeth_syn(pkt);

                if ((syn & AETH_TYPE_MASK) != AETH_ACK)
                        return COMPST_ERROR;

                if (wqe->wr.opcode != IB_WR_ATOMIC_CMP_AND_SWP &&
                    wqe->wr.opcode != IB_WR_ATOMIC_FETCH_AND_ADD)
                        return COMPST_ERROR;   <<<<<<<<<<<<<<<<<<<<<<<<<<
                reset_retry_counters(qp);
                return COMPST_ATOMIC;

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] RDMA/rxe: Set wqe->status correctly if an unexpected response is received
  2018-06-28  8:58     ` Moni Shoua
@ 2018-06-28 15:47       ` Bart Van Assche
  0 siblings, 0 replies; 6+ messages in thread
From: Bart Van Assche @ 2018-06-28 15:47 UTC (permalink / raw)
  To: Moni Shoua
  Cc: Yuval Shaia, Jason Gunthorpe, Doug Ledford, linux-rdma,
	yanjun.zhu@oracle.com, jianchao.w.wang@oracle.com,
	stable@vger.kernel.org

On 06/28/18 01:58, Moni Shoua wrote:
>> wqe->status is already set before the code that you mentioned has been
>> reached.
 >
> can you be more specific?
> for instance I didn't find similar behavior for the example below
> (also in check_ack())
> 
>          case IB_OPCODE_RC_ATOMIC_ACKNOWLEDGE:
>                  syn = aeth_syn(pkt);
> 
>                  if ((syn & AETH_TYPE_MASK) != AETH_ACK)
>                          return COMPST_ERROR;
> 
>                  if (wqe->wr.opcode != IB_WR_ATOMIC_CMP_AND_SWP &&
>                      wqe->wr.opcode != IB_WR_ATOMIC_FETCH_AND_ADD)
>                          return COMPST_ERROR;   <<<<<<<<<<<<<<<<<<<<<<<<<<
>                  reset_retry_counters(qp);
>                  return COMPST_ATOMIC;

Hello Moni,

I may have been wrong when I claimed that all other paths that return 
COMPST_ERROR already set wqe->status to an error value. However, I only 
have a test case for the path I modified. Hence my patch.

Bart.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] RDMA/rxe: Set wqe->status correctly if an unexpected response is received
  2018-06-26 15:39 [PATCH v2] RDMA/rxe: Set wqe->status correctly if an unexpected response is received Bart Van Assche
  2018-06-27 16:31 ` Yuval Shaia
@ 2018-08-08 15:58 ` Jason Gunthorpe
  1 sibling, 0 replies; 6+ messages in thread
From: Jason Gunthorpe @ 2018-08-08 15:58 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Doug Ledford, linux-rdma, Zhu Yanjun, Jianchao Wang, Yuval Shaia,
	stable

On Tue, Jun 26, 2018 at 08:39:36AM -0700, Bart Van Assche wrote:
> Every function that returns COMPST_ERROR must set wqe->status to
> another value than IB_WC_SUCCESS before returning COMPST_ERROR. Fix
> the only code path for which this is not yet the case.
> 
> Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
> Cc: Zhu Yanjun <yanjun.zhu@oracle.com>
> Cc: Jianchao Wang <jianchao.w.wang@oracle.com>
> Cc: Yuval Shaia <yuval.shaia@oracle.com>
> Cc: <stable@vger.kernel.org>
> Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
> ---
> 
> Changes compared to v1: left out a pr_err() statement as requested by Jason.
> 
>  drivers/infiniband/sw/rxe/rxe_comp.c | 1 +
>  1 file changed, 1 insertion(+)

applied to for-next

Thanks,
Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-08-08 18:19 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26 15:39 [PATCH v2] RDMA/rxe: Set wqe->status correctly if an unexpected response is received Bart Van Assche
2018-06-27 16:31 ` Yuval Shaia
2018-06-27 16:41   ` Bart Van Assche
2018-06-28  8:58     ` Moni Shoua
2018-06-28 15:47       ` Bart Van Assche
2018-08-08 15:58 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).