Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c00aaa1a authored by Mike Marciniszyn's avatar Mike Marciniszyn Committed by Roland Dreier
Browse files

IB/qib: Fix local access validation for user MRs



Commit 8aac4cc3 ("IB/qib: RCU locking for MR validation") introduced
a bug that broke user post sends.  The proper validation of the MR
was lost in the patch.

This patch corrects that validation.

Reviewed-by: default avatarDean Luick <dean.luick@intel.com>
Signed-off-by: default avatarMike Marciniszyn <mike.marciniszyn@intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent e20d5838
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -186,8 +186,9 @@ int qib_lkey_ok(struct qib_lkey_table *rkt, struct qib_pd *pd,
		goto bail;

	off = sge->addr - mr->user_base;
	if (unlikely(sge->addr < mr->iova || off + sge->length > mr->length ||
		     (mr->access_flags & acc) == 0))
	if (unlikely(sge->addr < mr->user_base ||
		     off + sge->length > mr->length ||
		     (mr->access_flags & acc) != acc))
		goto bail;
	if (unlikely(!atomic_inc_not_zero(&mr->refcount)))
		goto bail;