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 <behlendorf1@llnl.gov> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14044
This commit is contained in:
parent
bbec0e60a8
commit
409c99a1d3
|
@ -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
|
* If we've recovered the pool, pass back any information we
|
||||||
* gathered while doing the load.
|
* 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,
|
fnvlist_add_nvlist(*config, ZPOOL_CONFIG_LOAD_INFO,
|
||||||
spa->spa_load_info);
|
spa->spa_load_info);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue