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 for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250410113858.149032-1-frank.li@vivo.com>
Date: Thu, 10 Apr 2025 05:38:58 -0600
From: Yangtao Li <frank.li@...o.com>
To: clm@...com,
	josef@...icpanda.com,
	dsterba@...e.com
Cc: linux-btrfs@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	Yangtao Li <frank.li@...o.com>
Subject: [PATCH] btrfs: make error handling more appropriate in btrfs_delayed_ref_init()

1. Remove unnecessary goto
2. Make the execution logic of the function jumped by goto more appropriate

Signed-off-by: Yangtao Li <frank.li@...o.com>
---
 fs/btrfs/delayed-ref.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c
index 98c5b61dabe8..e984f1761afa 100644
--- a/fs/btrfs/delayed-ref.c
+++ b/fs/btrfs/delayed-ref.c
@@ -1339,11 +1339,11 @@ int __init btrfs_delayed_ref_init(void)
 {
 	btrfs_delayed_ref_head_cachep = KMEM_CACHE(btrfs_delayed_ref_head, 0);
 	if (!btrfs_delayed_ref_head_cachep)
-		goto fail;
+		return -ENOMEM;
 
 	btrfs_delayed_ref_node_cachep = KMEM_CACHE(btrfs_delayed_ref_node, 0);
 	if (!btrfs_delayed_ref_node_cachep)
-		goto fail;
+		goto out;
 
 	btrfs_delayed_extent_op_cachep = KMEM_CACHE(btrfs_delayed_extent_op, 0);
 	if (!btrfs_delayed_extent_op_cachep)
@@ -1351,6 +1351,8 @@ int __init btrfs_delayed_ref_init(void)
 
 	return 0;
 fail:
-	btrfs_delayed_ref_exit();
+	kmem_cache_destroy(btrfs_delayed_ref_node_cachep);
+out:
+	kmem_cache_destroy(btrfs_delayed_ref_head_cachep);
 	return -ENOMEM;
 }
-- 
2.39.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ