From fbbc375d43c6e2e746a0cff244dd5644f26d7972 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Thu, 22 Dec 2022 14:50:09 -0500 Subject: [PATCH] FreeBSD: Fix potential boot panic with bad label vdev_geom_read_pool_label() can leave NULL in configs. Check for it and skip consistently when generating rootconf. Reviewed-by: Alexander Motin Signed-off-by: Ryan Moeller Closes #14291 (cherry picked from commit dc8c2f615852cb79d3c4cae6c1fb738c7f4a793c) --- module/os/freebsd/zfs/spa_os.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/module/os/freebsd/zfs/spa_os.c b/module/os/freebsd/zfs/spa_os.c index a5445fa565..9032e64c9f 100644 --- a/module/os/freebsd/zfs/spa_os.c +++ b/module/os/freebsd/zfs/spa_os.c @@ -95,6 +95,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;