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-next>] [day] [month] [year] [list]
Message-Id: <20251106115815.3635405-1-zilin@seu.edu.cn>
Date: Thu,  6 Nov 2025 11:58:15 +0000
From: Zilin Guan <zilin@....edu.cn>
To: clm@...com
Cc: dsterba@...e.com,
	fdmanana@...e.com,
	neal@...pa.dev,
	boris@....io,
	linux-btrfs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	jianhao.xu@....edu.cn,
	Zilin Guan <zilin@....edu.cn>
Subject: [PATCH] btrfs: avoid redundant cleanup when device allocation fails

When device allocation fails, the chunk map has not been added to the
mapping tree, so locking for cleanup is unnecessary. Simply free the
chunk map as done when adding it to the mapping tree fails.

Fixes: bf2e2eb060fa2 ("btrfs: Add self-tests for btrfs_rmap_block")
Signed-off-by: Zilin Guan <zilin@....edu.cn>
---
 fs/btrfs/tests/extent-map-tests.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/btrfs/tests/extent-map-tests.c b/fs/btrfs/tests/extent-map-tests.c
index 42af6c737c6e..e227cfff1e8d 100644
--- a/fs/btrfs/tests/extent-map-tests.c
+++ b/fs/btrfs/tests/extent-map-tests.c
@@ -1036,7 +1036,8 @@ static int test_rmap_block(struct btrfs_fs_info *fs_info,
 		if (IS_ERR(dev)) {
 			test_err("cannot allocate device");
 			ret = PTR_ERR(dev);
-			goto out;
+			btrfs_free_chunk_map(map);
+			goto out_free;
 		}
 		map->stripes[i].dev = dev;
 		map->stripes[i].physical = test->data_stripe_phys_start[i];
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ