mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-27 10:24:22 +03:00
Fix usage of zsb after free
Caught by code inspection, the variable zsb was referenced after being freed. Move the kmem_free() to the end of the function. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
185853d9f2
commit
2708f716c0
@ -1527,20 +1527,19 @@ zfs_create_fs(objset_t *os, cred_t *cr, nvlist_t *zplprops, dmu_tx_t *tx)
|
|||||||
|
|
||||||
atomic_set(&ZTOI(rootzp)->i_count, 0);
|
atomic_set(&ZTOI(rootzp)->i_count, 0);
|
||||||
sa_handle_destroy(rootzp->z_sa_hdl);
|
sa_handle_destroy(rootzp->z_sa_hdl);
|
||||||
kmem_free(sb, sizeof (struct super_block));
|
|
||||||
kmem_free(zsb, sizeof (zfs_sb_t));
|
|
||||||
kmem_cache_free(znode_cache, rootzp);
|
kmem_cache_free(znode_cache, rootzp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create shares directory
|
* Create shares directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
error = zfs_create_share_dir(zsb, tx);
|
error = zfs_create_share_dir(zsb, tx);
|
||||||
|
|
||||||
ASSERT(error == 0);
|
ASSERT(error == 0);
|
||||||
|
|
||||||
for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
|
for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
|
||||||
mutex_destroy(&zsb->z_hold_mtx[i]);
|
mutex_destroy(&zsb->z_hold_mtx[i]);
|
||||||
|
|
||||||
|
kmem_free(sb, sizeof (struct super_block));
|
||||||
|
kmem_free(zsb, sizeof (zfs_sb_t));
|
||||||
}
|
}
|
||||||
#endif /* _KERNEL */
|
#endif /* _KERNEL */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user