Skip to content

Commit 1bd0268

Browse files
ryaobehlendorf
authored andcommitted
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
1 parent 3146fc7 commit 1bd0268

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

module/zfs/spa.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5267,7 +5267,7 @@ spa_open_common(const char *pool, spa_t **spapp, const void *tag,
52675267
* If we've recovered the pool, pass back any information we
52685268
* gathered while doing the load.
52695269
*/
5270-
if (state == SPA_LOAD_RECOVER) {
5270+
if (state == SPA_LOAD_RECOVER && config != NULL) {
52715271
fnvlist_add_nvlist(*config, ZPOOL_CONFIG_LOAD_INFO,
52725272
spa->spa_load_info);
52735273
}

0 commit comments

Comments
 (0)