From b6b1fd2a6bedd533aeed83924d7be0e944fded9f Mon Sep 17 00:00:00 2001 From: David Rientjes Date: Fri, 8 Sep 2017 16:13:29 -0700 Subject: [PATCH] mm/swapfile.c: fix swapon frontswap_map memory leak on error Free frontswap_map if an error is encountered before enable_swap_info(). Signed-off-by: David Rientjes Reviewed-by: "Huang, Ying" Cc: Darrick J. Wong Cc: Hugh Dickins Cc: [4.12+] Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/swapfile.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/swapfile.c b/mm/swapfile.c index 12251d386dc7..bf91dc9e7a79 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3291,6 +3291,7 @@ bad_swap: spin_unlock(&swap_lock); vfree(swap_map); kvfree(cluster_info); + kvfree(frontswap_map); if (swap_file) { if (inode && S_ISREG(inode->i_mode)) { inode_unlock(inode); -- 2.20.1