]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RDMA/rxe: Fix qp reference counting for atomic ops
authorBob Pearson <rpearsonhpe@gmail.com>
Fri, 4 Jun 2021 23:05:59 +0000 (18:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Jul 2021 14:15:50 +0000 (16:15 +0200)
[ Upstream commit 15ae1375ea91ae2dee6f12d71a79d8c0a10a30bf ]

Currently the rdma_rxe driver attempts to protect atomic responder
resources by taking a reference to the qp which is only freed when the
resource is recycled for a new read or atomic operation. This means that
in normal circumstances there is almost always an extra qp reference once
an atomic operation has been executed which prevents cleaning up the qp
and associated pd and cqs when the qp is destroyed.

This patch removes the call to rxe_add_ref() in send_atomic_ack() and the
call to rxe_drop_ref() in free_rd_atomic_resource(). If the qp is
destroyed while a peer is retrying an atomic op it will cause the
operation to fail which is acceptable.

Link: https://lore.kernel.org/r/20210604230558.4812-1-rpearsonhpe@gmail.com
Reported-by: Zhu Yanjun <zyjzyj2000@gmail.com>
Fixes: 86af61764151 ("IB/rxe: remove unnecessary skb_clone")
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/infiniband/sw/rxe/rxe_qp.c
drivers/infiniband/sw/rxe/rxe_resp.c

index 41c9ede98c265f18a847983d88a9b50be91ef112..4798b718b085b0055c874c88af7a22347ff60725 100644 (file)
@@ -151,7 +151,6 @@ static void free_rd_atomic_resources(struct rxe_qp *qp)
 void free_rd_atomic_resource(struct rxe_qp *qp, struct resp_res *res)
 {
        if (res->type == RXE_ATOMIC_MASK) {
-               rxe_drop_ref(qp);
                kfree_skb(res->atomic.skb);
        } else if (res->type == RXE_READ_MASK) {
                if (res->read.mr)
index 9078cfd3b8bdd99ac14f17170e3a47032af8d45f..b36d364f0fb54749f675e50441c6c1547f55e5f3 100644 (file)
@@ -999,8 +999,6 @@ static int send_atomic_ack(struct rxe_qp *qp, struct rxe_pkt_info *pkt,
                goto out;
        }
 
-       rxe_add_ref(qp);
-
        res = &qp->resp.resources[qp->resp.res_head];
        free_rd_atomic_resource(qp, res);
        rxe_advance_resp_resource(qp);