From: David Rientjes Date: Fri, 8 Sep 2017 23:13:29 +0000 (-0700) Subject: mm/swapfile.c: fix swapon frontswap_map memory leak on error X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b6b1fd2a6bedd533aeed83924d7be0e944fded9f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 --- 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);