This is a note to let you know that I've just added the patch titled mm/swapfile.c: fix swapon frontswap_map memory leak on error to the 4.12-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mm-swapfile.c-fix-swapon-frontswap_map-memory-leak-on-error.patch and it can be found in the queue-4.12 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From b6b1fd2a6bedd533aeed83924d7be0e944fded9f Mon Sep 17 00:00:00 2001 From: David Rientjes <rientjes@xxxxxxxxxx> Date: Fri, 8 Sep 2017 16:13:29 -0700 Subject: mm/swapfile.c: fix swapon frontswap_map memory leak on error From: David Rientjes <rientjes@xxxxxxxxxx> commit b6b1fd2a6bedd533aeed83924d7be0e944fded9f upstream. Free frontswap_map if an error is encountered before enable_swap_info(). Signed-off-by: David Rientjes <rientjes@xxxxxxxxxx> Reviewed-by: "Huang, Ying" <ying.huang@xxxxxxxxx> Cc: Darrick J. Wong <darrick.wong@xxxxxxxxxx> Cc: Hugh Dickins <hughd@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- mm/swapfile.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2904,6 +2904,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); Patches currently in stable-queue which might be from rientjes@xxxxxxxxxx are queue-4.12/mm-swapfile.c-fix-swapon-frontswap_map-memory-leak-on-error.patch queue-4.12/mm-kvfree-the-swap-cluster-info-if-the-swap-file-is-unsatisfactory.patch