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 <mav@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #14291
This commit is contained in:
Ryan Moeller 2022-12-22 14:50:09 -05:00 committed by GitHub
parent 018f26041d
commit dc8c2f6158
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View 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;