]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
xfs: fix a rtgroup leak when xfs_init_zone fails
authorChristoph Hellwig <hch@lst.de>
Tue, 4 Nov 2025 13:50:53 +0000 (08:50 -0500)
committerCarlos Maiolino <cem@kernel.org>
Wed, 5 Nov 2025 15:53:49 +0000 (16:53 +0100)
Drop the rtgrop reference when xfs_init_zone fails for a conventional
device.

Fixes: 4e4d52075577 ("xfs: add the zoned space allocator")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Hans Holmberg <hans.holmberg@wdc.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_zone_alloc.c

index 0404022408078bf6bdd07c3f31edfca78b5be13f..fa76fa4ba0f9bf87cb0624839bcf25ab3538f4a6 100644 (file)
@@ -1249,8 +1249,10 @@ xfs_mount_zones(
 
                while ((rtg = xfs_rtgroup_next(mp, rtg))) {
                        error = xfs_init_zone(&iz, rtg, NULL);
-                       if (error)
+                       if (error) {
+                               xfs_rtgroup_rele(rtg);
                                goto out_free_zone_info;
+                       }
                }
        }