Skip to content

Commit

Permalink
Reopen of vdev_file would panic
Browse files Browse the repository at this point in the history
Attempting to spa_strfree() of a NULL name. When we skip
the open, we do not have the name assigned.
  • Loading branch information
lundman committed Feb 22, 2023
1 parent 0d8d864 commit eed7d32
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions module/os/windows/zfs/vdev_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,

if (error) {
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
spa_strfree(vdev_path);
if (vdev_path != NULL)
spa_strfree(vdev_path);
return (error);
}

Expand All @@ -200,7 +201,8 @@ vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,
*/
// zfs_file_close(fp);
vdev_file_close(vd);
spa_strfree(vdev_path);
if (vdev_path != NULL)
spa_strfree(vdev_path);
return (SET_ERROR(ENODEV));
}

Expand Down Expand Up @@ -233,14 +235,16 @@ vdev_file_open(vdev_t *vd, uint64_t *psize, uint64_t *max_psize,

if (error) {
vd->vdev_stat.vs_aux = VDEV_AUX_OPEN_FAILED;
spa_strfree(vdev_path);
if (vdev_path != NULL)
spa_strfree(vdev_path);
return (error);
}

*max_psize = *psize = zfa.zfa_size;
*ashift = SPA_MINBLOCKSHIFT;
*physical_ashift = SPA_MINBLOCKSHIFT;
spa_strfree(vdev_path);
if (vdev_path != NULL)
spa_strfree(vdev_path);
return (0);
}

Expand Down

0 comments on commit eed7d32

Please sign in to comment.