diff options
author | Richard Yao <[email protected]> | 2022-10-16 00:19:13 -0400 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2022-12-01 12:39:42 -0800 |
commit | 409c99a1d3e5c47c5b61a4d471c60c5b92c887a6 (patch) | |
tree | 12dac0808d034aa9848a5087d9d35419d25d3af1 /module | |
parent | bbec0e60a8e75e9f63a6a415a86054b42ef6d675 (diff) |
Fix NULL pointer dereference in spa_open_common()
Calling spa_open() will pass a NULL pointer to spa_open_common()'s
config parameter. Under the right circumstances, we will dereference the
config parameter without doing a NULL check.
Clang's static analyzer found this.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #14044
Diffstat (limited to 'module')
-rw-r--r-- | module/zfs/spa.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 86447d1fd..c9759f35a 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -5230,7 +5230,7 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy, * If we've recovered the pool, pass back any information we * gathered while doing the load. */ - if (state == SPA_LOAD_RECOVER) { + if (state == SPA_LOAD_RECOVER && config != NULL) { fnvlist_add_nvlist(*config, ZPOOL_CONFIG_LOAD_INFO, spa->spa_load_info); } |