🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: org.gnu.grub-devel
Article #1

[PATCH] fs/zfs: Fix another memory leak in ZFS code

#1
From: Glenn Washburn
Date: Mon, 05 May 2025 22:09
31 lines
7000 bytes
Commit b66c6f918 ("fs/zfs: Fix a number of memory leaks in ZFS code")
fixes many of the same leaks detected in bug #63846 except one, which
is fixed here.

Fixes: https://savannah.gnu.org/bugs/?63846
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
Reviewing some of the bugs on Savannah, I noticed #63846 which, apparently,
independently fixes some of the same leaks as fixed in the more recent
commit b66c6f918. The one change in the Savannah bug patch that I did not find
in b66c6f918 is the one here. The fix has been modified from the original
patch to be in the style of the other similar fixes in b66c6f918.

Glenn
---
 grub-core/fs/zfs/zfs.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/grub-core/fs/zfs/zfs.c b/grub-core/fs/zfs/zfs.c
index bff9d0208b9f..8036b2e31cc5 100644
--- a/grub-core/fs/zfs/zfs.c
+++ b/grub-core/fs/zfs/zfs.c
@@ -3052,6 +3052,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
 	  void *sahdrp;
 	  int hdrsize;
 	  grub_size_t sz;
+	  bool free_sahdrp = false;
 
 	  if (dnode_path->dn.dn.dn_bonuslen != 0)
 	    {
@@ -3064,6 +3065,7 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
 	      err = zio_read (bp, dnode_path->dn.endian, &sahdrp, NULL, data);
 	      if (err)
 	        break;
+	      free_sahdrp = true;
 	    }
 	  else
 	    {
@@ -3122,6 +3124,9 @@ dnode_get_path (struct subvolume *subvol, const char *path_in, dnode_end_t *dn,
 		     }
 	      dn_new = dnode_path;
 	    }
+	  if (free_sahdrp)
+	    grub_free (sahdrp);
+
 	}
     }
 
-- 
2.34.1


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
Technical Details
Message-ID: <20250505220919.80745-1-development@efficientek.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!nntp.lore.kernel.org!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <20250505220919.80745-1-development@efficientek.com>
Subject: [PATCH] fs/zfs: Fix another memory leak in ZFS code
Date: Mon, 5 May 2025 17:09:19 -0500
From: Glenn Washburn <development@efficientek.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!nntp.lore.kernel.org!not-for-mail
Return-Path: <grub-devel-bounces+grub-devel=archiver.kernel.org@gnu.org>
X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on
 aws-us-west-2-korg-lkml-1.web.codeaurora.org
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
 (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 0EB04C3ABB6
Received: from localhost ([::1] helo=lists1p.gnu.org)
 by lists.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <grub-devel-bounces@gnu.org>)
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <development@efficientek.com>)
 id 1uC40L-0005yd-KC
Received: from mail-yw1-x112b.google.com ([2607:f8b0:4864:20::112b])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <development@efficientek.com>)
 id 1uC40I-0003HV-FD
Received: by mail-yw1-x112b.google.com with SMTP id
 00721157ae682-702628e34f2so42994367b3.0
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=efficientek-com.20230601.gappssmtp.com; s=20230601; t=1746482975;
 x=1747087775; darn=gnu.org; 
 h=content-transfer-encoding:mime-version:message-id:date:subject:cc
 :to:from:from:to:cc:subject:date:message-id:reply-to;
 bh=WWBBvMv625MsPTX/alG4NNmvToRsMWNJd1IZbnY4gQM=;
 b=VHjelPRQq3USJpbAjwkO92frYZ7h9tERWw340klEXvFtkhRDO26lnh7I4BAe4zLjN9
 6EzohV6aXRZlcdW+3HJ9r/JlahkEoWg2UZE5LxVd7XMWOeOvoWS48piA7sk04uvzrZ52
 geeMaf+dnjpN2FqpnLBt2Lxj5LAHMFaayZEjWFwFILBbdLe9qiKrITPOG93pCUPey7j3
 G8FxUnHYiqXzC0v6AENUZdTT+NLvYtVZcldlGGy2ofZ+aFQhiPg5U9Is4d8vncVDytCR
 /FEQo2OcNaoQ/DUKohvEtRbEd4hmXKx0l1fA8sL5Ru+MxTTA2/UKBZR18D6XNPtZqcT/
 gA/w==
X-Gm-Message-State: AOJu0Yw7cKHnwHGVgdnJS2tzx9QCwQakgbCkDrKnLvsAPgt4o6Wee2Qa
 76y1yDWQbNzN7ao/ziUAB7MHdbkhuaf6vOyr56bdZqatin2j8FlqGf8C58XM2b4YLnu6iCoIvYQ
 =
X-Gm-Gg: ASbGncv9T1/sUjOjnYV7XnmQUvaLFL1DaW3mp0QzAt0bESYfUC5rl9pNJ/EDwfzNrdl
 WYLmPUeBchbEubq8Gv/Mipxj00L2mwzOFPBEYlkluAplSa5CHFmCwmmtP40HOlDbrQrnAcxKk1p
 V2Aqox+F/lNxpAo2EyxgOCVzPDQa3dC/6QM4xTUv4UEeYwuTGa+XmX/Kbc7gl92XsrT6Ox886+t
 PESTxx0SbAcoj3k/F6u0Ma9fKflezPzYMJNaZodMidGbZN604MTcOazTUF1oIVMlu7+34UPbGSa
 rxtCc2GIurAkqoatoWGl+zHs0xxXVBdfOFRe7vWQ662Hh23MSN25Gkjy3uNl4g==
X-Received: by 2002:a05:690c:6009:b0:6fb:9445:d28e with SMTP id
 00721157ae682-7091890e170mr17393017b3.10.1746482975295; 
Received: from localhost.localdomain ([199.58.83.12])
 by smtp.gmail.com with ESMTPSA id
 00721157ae682-708c3f08280sm23988967b3.11.2025.05.05.15.09.33
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
To: grub-devel@gnu.org,
 Daniel Kiper <dkiper@net-space.pl>
Cc: Vladimir Serbinenko <phcoder@gmail.com>,
 Stuart Hayes <stuart.w.hayes@gmail.com>,
 Glenn Washburn <development@efficientek.com>
X-Mailer: git-send-email 2.34.1
MIME-Version: 1.0
Received-SPF: pass client-ip=2607:f8b0:4864:20::112b;
 envelope-from=development@efficientek.com; helo=mail-yw1-x112b.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-BeenThere: grub-devel@gnu.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: The development of GNU GRUB <grub-devel.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/grub-devel>,
 <mailto:grub-devel-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/grub-devel>
List-Post: <mailto:grub-devel@gnu.org>
List-Help: <mailto:grub-devel-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/grub-devel>,
 <mailto:grub-devel-request@gnu.org?subject=subscribe>
Reply-To: The development of GNU GRUB <grub-devel@gnu.org>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
Errors-To: grub-devel-bounces+grub-devel=archiver.kernel.org@gnu.org
Sender: grub-devel-bounces+grub-devel=archiver.kernel.org@gnu.org
Newsgroups: org.gnu.grub-devel