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
3146fc7edf
commit
1bd02680c0
|
@ -5267,7 +5267,7 @@ spa_open_common(const char *pool, spa_t **spapp, const void *tag,
|
|||
* 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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue