From: loli10K Date: Fri, 24 May 2019 02:17:00 +0000 (+0200) Subject: Fix coverity defects: CID 186143 X-Git-Tag: zfs-0.8.1~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cc434dcf451ef9145dd7777ffe2c2a3ae3a276e4;p=zfs Fix coverity defects: CID 186143 CID 186143: Memory - illegal accesses (USE_AFTER_FREE) This patch fixes an use-after-free in spa_import_progress_destroy() moving the kmem_free() call at the end of the function. Reviewed-by: Chris Dunlop Reviewed-by: Giuseppe Di Natale Reviewed-by: Igor Kozhukhov Reviewed-by: George Melikov Reviewed by: Brian Behlendorf Signed-off-by: loli10K Closes #8788 --- diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index dddbe9cfa..a111a9e4e 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -2102,8 +2102,8 @@ spa_import_progress_destroy(void) spa_history_list_t *shl = spa_import_progress_list; procfs_list_uninstall(&shl->procfs_list); spa_import_progress_truncate(shl, 0); - kmem_free(shl, sizeof (spa_history_list_t)); procfs_list_destroy(&shl->procfs_list); + kmem_free(shl, sizeof (spa_history_list_t)); } int