From patchwork Sun Mar 20 13:30:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Simmons X-Patchwork-Id: 12786519 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from pdx1-mailman02.dreamhost.com (pdx1-mailman02.dreamhost.com [64.90.62.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DDC7DC433F5 for ; Sun, 20 Mar 2022 13:33:22 +0000 (UTC) Received: from pdx1-mailman02.dreamhost.com (localhost [IPv6:::1]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 819DD21FA50; Sun, 20 Mar 2022 06:32:19 -0700 (PDT) Received: from smtp3.ccs.ornl.gov (smtp3.ccs.ornl.gov [160.91.203.39]) by pdx1-mailman02.dreamhost.com (Postfix) with ESMTP id 52A1F21CABE for ; Sun, 20 Mar 2022 06:31:21 -0700 (PDT) Received: from star.ccs.ornl.gov (star.ccs.ornl.gov [160.91.202.134]) by smtp3.ccs.ornl.gov (Postfix) with ESMTP id 8E5871027; Sun, 20 Mar 2022 09:31:08 -0400 (EDT) Received: by star.ccs.ornl.gov (Postfix, from userid 2004) id 8B03FAB; Sun, 20 Mar 2022 09:31:08 -0400 (EDT) From: James Simmons To: Andreas Dilger , Oleg Drokin , NeilBrown Date: Sun, 20 Mar 2022 09:30:58 -0400 Message-Id: <1647783064-20688-45-git-send-email-jsimmons@infradead.org> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1647783064-20688-1-git-send-email-jsimmons@infradead.org> References: <1647783064-20688-1-git-send-email-jsimmons@infradead.org> Subject: [lustre-devel] [PATCH 44/50] lnet: lnet_peer_data_present() memory leak X-BeenThere: lustre-devel@lists.lustre.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "For discussing Lustre software development." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Chris Horn , Lustre Development List MIME-Version: 1.0 Errors-To: lustre-devel-bounces@lists.lustre.org Sender: "lustre-devel" From: Chris Horn If the ping buffer has nnis <= 1 then the ref on the ping buffer does not get dropped. This causes a memory leak. WC-bug-id: https://jira.whamcloud.com/browse/LU-15440 Lustre-commit: 56384a4fc39ff99c8 ("U-15440 lnet: lnet_peer_data_present() memory leak") Signed-off-by: Chris Horn Reviewed-on: https://review.whamcloud.com/46052 Reviewed-by: Serguei Smirnov Reviewed-by: Andriy Skulysh Reviewed-by: James Simmons Reviewed-by: Alexey Lyashkov Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- net/lnet/lnet/peer.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/lnet/lnet/peer.c b/net/lnet/lnet/peer.c index f70ceb5..16a694c 100644 --- a/net/lnet/lnet/peer.c +++ b/net/lnet/lnet/peer.c @@ -3344,8 +3344,10 @@ static int lnet_peer_data_present(struct lnet_peer *lp) * primary NID to the correct value here. Moreover, this peer * can show up with only the loopback NID in the ping buffer. */ - if (pbuf->pb_info.pi_nnis <= 1) + if (pbuf->pb_info.pi_nnis <= 1) { + lnet_ping_buffer_decref(pbuf); goto out; + } nid = pbuf->pb_info.pi_ni[1].ns_nid; if (nid_is_lo0(&lp->lp_primary_nid)) { rc = lnet_peer_set_primary_nid(lp, nid, flags);