lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250421154029.2399-1-superman.xpt@gmail.com>
Date: Mon, 21 Apr 2025 08:40:29 -0700
From: Penglei Jiang <superman.xpt@...il.com>
To: quwenruo.btrfs@....com
Cc: clm@...com,
	dsterba@...e.com,
	josef@...icpanda.com,
	linux-btrfs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	superman.xpt@...il.com
Subject: [PATCH v2] btrfs: fix the resource leak issue in btrfs_iget()

When btrfs_iget() returns an error, it does not use iget_failed() to mark
and release the inode. Now, we add the missing iget_failed() call.

Fixes: 7c855e16ab72 ("btrfs: remove conditional path allocation in btrfs_read_locked_inode()")
Reported-by: Penglei Jiang <superman.xpt@...il.com>
Signed-off-by: Penglei Jiang <superman.xpt@...il.com>
---
V1 -> V2: Fixed the issue with multiple calls to btrfs_iget()

 fs/btrfs/inode.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index cc67d1a2d611..1cbf92ca748d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5681,8 +5681,10 @@ struct btrfs_inode *btrfs_iget(u64 ino, struct btrfs_root *root)
 		return inode;
 
 	path = btrfs_alloc_path();
-	if (!path)
+	if (!path) {
+		iget_failed(&inode->vfs_inode);
 		return ERR_PTR(-ENOMEM);
+	}
 
 	ret = btrfs_read_locked_inode(inode, path);
 	btrfs_free_path(path);
-- 
2.17.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ