From 19696fec3667a48322a70d9b7fe0c0358ace34ad Mon Sep 17 00:00:00 2001 From: George Wilson Date: Fri, 26 Aug 2022 16:04:27 -0500 Subject: [PATCH] Importing from cachefile can trip assertion When importing from cachefile, it is possible that the builtin retry logic will trip an assertion because it also fails to find the pool. This fix addresses that case and returns the correct error message to the user. Reviewed-by: Richard Yao Reviewed-by: Serapheim Dimitropoulos Reviewed-by: Brian Behlendorf Signed-off-by: George Wilson Closes #13781 --- lib/libzutil/zutil_import.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c index cd8e2f7cecef..63a4bd7d3788 100644 --- a/lib/libzutil/zutil_import.c +++ b/lib/libzutil/zutil_import.c @@ -1695,6 +1695,8 @@ zpool_find_import_cached(libpc_handle_t *hdl, importargs_t *iarg) * caller. */ nvpair_t *pair = nvlist_next_nvpair(nv, NULL); + if (pair == NULL) + continue; fnvlist_add_nvlist(pools, nvpair_name(pair), fnvpair_value_nvlist(pair));