Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2836430pxv; Mon, 12 Jul 2021 03:09:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzbjwiOMT7ykzPcv+yxBqZedvoH2bMwsurkF3w4W56QvC6vzoN6fAHEO81WLs5CiXLm1CJ+ X-Received: by 2002:a02:a38f:: with SMTP id y15mr19228792jak.108.1626084541417; Mon, 12 Jul 2021 03:09:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626084541; cv=none; d=google.com; s=arc-20160816; b=mrCcZBPnH0LiiLZX8FUUd+YYDo5A+F7YCAfhjxbjTqZshOLdQmJ20a39YX2ls5TnTX nkKzDP019pqzngU/JDZYp544XbpBp3ZCG/TJZUOFqEKN0T+1qR+SynpB31bgrTKy74lA LwDWbSPFR7ctz5C7XXjhPT0fJXrRqD6zdb0MGB0m0io8L24is+1P4LtEbeGPYSseWGc2 VYrmD/b8Yy2q6y7QEL91zijq0OPFhdfxt56K54sbBHTu/cScK9gujkt0KMsuag4yKSO9 O/DgsEKFsiSqHJvbBLX/2f3yeJha411zi1TYriQWgLppUC+zuPm6bjMft/jSa8m2PPzs WbSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=tn8y43G6JUU1Ya8lLwGNah9HTbYILT+lOcJiosv4bLU=; b=oRhSWp7cJbauHlcIDHPazwMD7k5tu9lYDz5cxxKxYrtU9fLsNEVkWPCsX5NDbvrmU5 77ZdoyUTtaUuhW4sbQJUCNSaKixDtplQ+zxSrb1kd+7t0VcLLYE50e7o8rTfrx5ns1k5 2EX60ES527AIWeSCyCfU19zvcVNxGvSZ6I/p/b3OZYw+pXyV1zGhWN5CrzHO1J2SHKpJ yUqr8XWSz3UDgH+o8DSCZR0P7aT79am2jCS38xzn15MHAyz+7tvI9ta/FIR5OdE6mt/q cXe2I81yNNrQl9reP/iacxhg6isHVimiSL21p7eA2lCEdrfYVs/wjawkx/K8mwnR+bvZ yVDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z+ez1Zic; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n5si19875882ilj.6.2021.07.12.03.08.49; Mon, 12 Jul 2021 03:09:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Z+ez1Zic; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350242AbhGLHur (ORCPT + 99 others); Mon, 12 Jul 2021 03:50:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:48022 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242504AbhGLHQ3 (ORCPT ); Mon, 12 Jul 2021 03:16:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2582361156; Mon, 12 Jul 2021 07:12:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626073977; bh=bevA9dOp0eJbl1TYf2u7t3Kb/T5Cr4MeAROOWHPFzB4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Z+ez1ZicX7I6zQapIc4Dva7I5ZxiMuybXB/j/9m9nCwE+2v/o7t4WiuKibuRXDXX/ IizxJsd7JlIsB25g95AUq2rg8ETKWB4w3BMstlJ+C0eAHQ062qpKpfVjNVPks+MdZy xSpudup4CCYF4w/OhrR14rGQfa1nfH8UurezT8UE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhu Yanjun , Bob Pearson , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.12 423/700] RDMA/rxe: Fix qp reference counting for atomic ops Date: Mon, 12 Jul 2021 08:08:26 +0200 Message-Id: <20210712061021.391251941@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bob Pearson [ 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 Fixes: 86af61764151 ("IB/rxe: remove unnecessary skb_clone") Signed-off-by: Bob Pearson Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/sw/rxe/rxe_qp.c | 1 - drivers/infiniband/sw/rxe/rxe_resp.c | 2 -- 2 files changed, 3 deletions(-) diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c index b0f350d674fd..93a41ebda1a8 100644 --- a/drivers/infiniband/sw/rxe/rxe_qp.c +++ b/drivers/infiniband/sw/rxe/rxe_qp.c @@ -136,7 +136,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) diff --git a/drivers/infiniband/sw/rxe/rxe_resp.c b/drivers/infiniband/sw/rxe/rxe_resp.c index 8e237b623b31..ae97bebc0f34 100644 --- a/drivers/infiniband/sw/rxe/rxe_resp.c +++ b/drivers/infiniband/sw/rxe/rxe_resp.c @@ -966,8 +966,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); -- 2.30.2