Plug memory leak in zfsdev_state.

On kernel module unload, free all zfsdev state structures, except for
zfsdev_state_listhead, which is statically allocated.

Reviewed-by: Richard Yao <richard.yao@alumni.stonybrook.edu>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Pawel Jakub Dawidek <pawel@dawidek.net>
Closes #14824
This commit is contained in:
Pawel Jakub Dawidek 2023-05-06 00:51:41 +09:00 committed by GitHub
parent 82ac409acc
commit 599df82049
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -7862,6 +7862,8 @@ zfs_kmod_fini(void)
zfs_onexit_destroy(zs->zs_onexit); zfs_onexit_destroy(zs->zs_onexit);
if (zs->zs_zevent) if (zs->zs_zevent)
zfs_zevent_destroy(zs->zs_zevent); zfs_zevent_destroy(zs->zs_zevent);
if (zs != &zfsdev_state_listhead)
kmem_free(zs, sizeof (zfsdev_state_t));
} }
zfs_ereport_taskq_fini(); /* run before zfs_fini() on Linux */ zfs_ereport_taskq_fini(); /* run before zfs_fini() on Linux */