IB/rxe: Fix up the responder's find_resources() function
authorAndrew Boyer <andrew.boyer@dell.com>
Mon, 28 Aug 2017 20:11:52 +0000 (16:11 -0400)
committerDoug Ledford <dledford@redhat.com>
Mon, 28 Aug 2017 23:12:33 +0000 (19:12 -0400)
The resource array is sized by max_dest_rd_atomic, not max_rd_atomic.
Iterating over max_rd_atomic entries of qp->resp.resources[] will cause
incorrect behavior when the two attributes are different (or even
crash if max_rd_atomic is larger).

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Andrew Boyer <andrew.boyer@dell.com>
Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/infiniband/sw/rxe/rxe_resp.c

index a958ee918a49f0a8b1e23b63fa20a9d8a4db5e7d..4240866a5331921f887ffc351d1b385c4aea5760 100644 (file)
@@ -1055,7 +1055,7 @@ static struct resp_res *find_resource(struct rxe_qp *qp, u32 psn)
 {
        int i;
 
-       for (i = 0; i < qp->attr.max_rd_atomic; i++) {
+       for (i = 0; i < qp->attr.max_dest_rd_atomic; i++) {
                struct resp_res *res = &qp->resp.resources[i];
 
                if (res->type == 0)