]> git.proxmox.com Git - mirror_zfs.git/commitdiff
FreeBSD: Fix potential boot panic with bad label
authorRyan Moeller <ryan@iXsystems.com>
Thu, 22 Dec 2022 19:50:09 +0000 (14:50 -0500)
committerGitHub <noreply@github.com>
Thu, 22 Dec 2022 19:50:09 +0000 (11:50 -0800)
vdev_geom_read_pool_label() can leave NULL in configs.  Check for it
and skip consistently when generating rootconf.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #14291

module/os/freebsd/zfs/spa_os.c

index 45ea10bb487de703ba7f27ace7f2ee1deb823e65..449c1624817ed443a97f968eaac4d3afba313a25 100644 (file)
@@ -94,6 +94,8 @@ spa_generate_rootconf(const char *name)
        for (i = 0; i < count; i++) {
                uint64_t txg;
 
+               if (configs[i] == NULL)
+                       continue;
                txg = fnvlist_lookup_uint64(configs[i], ZPOOL_CONFIG_POOL_TXG);
                if (txg > best_txg) {
                        best_txg = txg;