From 26d855110f28f8d8e7ee73ed19db7f41b945da63 Mon Sep 17 00:00:00 2001 From: loli10K Date: Fri, 24 May 2019 04:17:00 +0200 Subject: [PATCH] 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 --- module/zfs/spa_misc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index 941d8fb98648..31489365eb4c 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -2108,8 +2108,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