From: Mike Marciniszyn Date: Fri, 28 Sep 2012 17:33:52 +0000 (+0000) Subject: IB/qib: Fix local access validation for user MRs X-Git-Tag: v3.6.1~4 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=f3b01b793ca3a8787df8994e4a0cab5a59a24e5f;p=karo-tx-linux.git IB/qib: Fix local access validation for user MRs commit c00aaa1a0221a22153071fcb2f320e2ebaecc2fd upstream. Commit 8aac4cc3a9d7 ("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: Dean Luick Signed-off-by: Mike Marciniszyn Signed-off-by: Roland Dreier Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/infiniband/hw/qib/qib_keys.c b/drivers/infiniband/hw/qib/qib_keys.c index e9486c74c226..81c7b73695d2 100644 --- a/drivers/infiniband/hw/qib/qib_keys.c +++ b/drivers/infiniband/hw/qib/qib_keys.c @@ -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;