linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH for-rc] IB/rdmavt: Validate remote_addr during loopback atomic tests
@ 2022-01-19  9:28 mike.marciniszyn
  2022-01-23 10:34 ` Leon Romanovsky
  2022-01-28 16:51 ` Jason Gunthorpe
  0 siblings, 2 replies; 8+ messages in thread
From: mike.marciniszyn @ 2022-01-19  9:28 UTC (permalink / raw)
  To: jgg; +Cc: linux-rdma, Mike Marciniszyn

From: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>

The rdma-core test suite sends an unaligned remote address
and expects a failure.

ERROR: test_atomic_non_aligned_addr (tests.test_atomic.AtomicTest)

The qib/hfi1 rc handling validates properly, but the test has the
client and server on the same system.

The loopback of these operations is a distinct code path.

Fix by syntaxing the proposed remote address in the loopback
code path.

Fixes: 15703461533a ("IB/{hfi1, qib, rdmavt}: Move ruc_loopback to rdmavt")
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
---
 drivers/infiniband/sw/rdmavt/qp.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/infiniband/sw/rdmavt/qp.c b/drivers/infiniband/sw/rdmavt/qp.c
index 3305f27..ae50b56 100644
--- a/drivers/infiniband/sw/rdmavt/qp.c
+++ b/drivers/infiniband/sw/rdmavt/qp.c
@@ -3073,6 +3073,8 @@ void rvt_ruc_loopback(struct rvt_qp *sqp)
 	case IB_WR_ATOMIC_FETCH_AND_ADD:
 		if (unlikely(!(qp->qp_access_flags & IB_ACCESS_REMOTE_ATOMIC)))
 			goto inv_err;
+		if (unlikely(wqe->atomic_wr.remote_addr & (sizeof(u64) - 1)))
+			goto inv_err;
 		if (unlikely(!rvt_rkey_ok(qp, &qp->r_sge.sge, sizeof(u64),
 					  wqe->atomic_wr.remote_addr,
 					  wqe->atomic_wr.rkey,
-- 
1.8.3.1


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

end of thread, other threads:[~2022-01-28 16:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-19  9:28 [PATCH for-rc] IB/rdmavt: Validate remote_addr during loopback atomic tests mike.marciniszyn
2022-01-23 10:34 ` Leon Romanovsky
2022-01-24 12:25   ` Haakon Bugge
2022-01-24 12:33     ` Leon Romanovsky
2022-01-24 12:43       ` Haakon Bugge
2022-01-24 13:20         ` Marciniszyn, Mike
2022-01-25  7:34           ` Leon Romanovsky
2022-01-28 16:51 ` 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).