From patchwork Sat Nov 16 09:57:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: jiang.kun2@zte.com.cn X-Patchwork-Id: 13877543 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7A2A663C; Sat, 16 Nov 2024 09:58:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=63.216.63.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731751099; cv=none; b=Zq2sDnzHsvckHdItVxlkT88oX/5IEGZRRNM39Dp3oa0tSSbLyYKjuhaStYRjKvdtQwN5/ayZGBO7cFaZysxGGFpUJrssmIRfeqhqTb1I2sn6D1Xq5gcEaRT4N8emRej9fY2frC/a4dQnRziqf2eXeILkmPjW7/dhllL9EDoE77w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731751099; c=relaxed/simple; bh=E6j9oslTtrd+6h5B0lvb2SEtDC8mDtkgt4cXNhvxTM8=; h=Date:Message-ID:Mime-Version:From:To:Cc:Subject:Content-Type; b=Qol6Js/1UzysJx5upOhAe8OVq63mT7SCrfUstr+ME+6t230IvOYvxaTxi25m1KwN/b/VgkMWtr7r+vNB/FWGCV5q9+lx760VblpYQX0l4c5jEQRQ/7TZWsqkXwyrXzHxH0l77TPtJewCkU8JfMmgU+OGSX8GKBf4PKbJHWq3Ef8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn; spf=pass smtp.mailfrom=zte.com.cn; arc=none smtp.client-ip=63.216.63.35 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=zte.com.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zte.com.cn Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4Xr8TX5nlfz5B1Gv; Sat, 16 Nov 2024 17:58:08 +0800 (CST) Received: from njy2app01.zte.com.cn ([10.40.12.136]) by mse-fl1.zte.com.cn with SMTP id 4AG9vjUp056776; Sat, 16 Nov 2024 17:57:45 +0800 (+08) (envelope-from jiang.kun2@zte.com.cn) Received: from mapi (njy2app08[null]) by mapi (Zmail) with MAPI id mid204; Sat, 16 Nov 2024 17:57:48 +0800 (CST) Date: Sat, 16 Nov 2024 17:57:48 +0800 (CST) X-Zmail-TransId: 2b0067386c9c512-2065a X-Mailer: Zmail v1.0 Message-ID: <20241116175748571awvOCFyR9lCLwe61IhOXL@zte.com.cn> Precedence: bulk X-Mailing-List: linux-rdma@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 From: To: , , , , , Cc: , , Subject: =?utf-8?q?=5BPATCH_STABLE_5=2E10=5D_RDMA/restrack=3A_Release_MR/QP_?= =?utf-8?q?restrack_when_delete?= X-MAIL: mse-fl1.zte.com.cn 4AG9vjUp056776 X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 67386CB0.001/4Xr8TX5nlfz5B1Gv From: tuqiang The MR/QP restrack also needs to be released when delete it, otherwise it cause memory leak as the task struct won't be released. This problem has been fixed by the commit ("RDMA/restrack: Release MR restrack when delete"), but still exists in the linux-5.10.y branch. Fixes: 13ef5539def7 ("RDMA/restrack: Count references to the verbs objects") Signed-off-by: tuqiang Signed-off-by: Jiang Kun Cc: stable@vger.kernel.org Cc: xu xin Cc: Doug Ledford Cc: Jason Gunthorpe Cc: Leon Romanovsky --- drivers/infiniband/core/restrack.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/infiniband/core/restrack.c b/drivers/infiniband/core/restrack.c index bbbbec5b1593..d5a69c4a1891 100644 --- a/drivers/infiniband/core/restrack.c +++ b/drivers/infiniband/core/restrack.c @@ -326,8 +326,6 @@ void rdma_restrack_del(struct rdma_restrack_entry *res) rt = &dev->res[res->type]; old = xa_erase(&rt->xa, res->id); - if (res->type == RDMA_RESTRACK_MR || res->type == RDMA_RESTRACK_QP) - return; WARN_ON(old != res); res->valid = false;