Skip to content

Commit 409c99a

Browse files
ryaotonyhutter
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 openzfs#14044
1 parent bbec0e6 commit 409c99a

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
@@ -5230,7 +5230,7 @@ spa_open_common(const char *pool, spa_t **spapp, void *tag, nvlist_t *nvpolicy,
52305230
* If we've recovered the pool, pass back any information we
52315231
* gathered while doing the load.
52325232
*/
5233-
if (state == SPA_LOAD_RECOVER) {
5233+
if (state == SPA_LOAD_RECOVER && config != NULL) {
52345234
fnvlist_add_nvlist(*config, ZPOOL_CONFIG_LOAD_INFO,
52355235
spa->spa_load_info);
52365236
}

0 commit comments

Comments
 (0)