aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Rientjes <rientjes@google.com>2017-09-08 19:13:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-08 21:26:47 -0400
commitb6b1fd2a6bedd533aeed83924d7be0e944fded9f (patch)
tree406e66f717c827dd6c67d9953a9e7bfefb9c9278
parent8606a1a94da5c4e49c0fb28af62d2e75c6747716 (diff)
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 <rientjes@google.com> Reviewed-by: "Huang, Ying" <ying.huang@intel.com> Cc: Darrick J. Wong <darrick.wong@oracle.com> Cc: Hugh Dickins <hughd@google.com> Cc: <stable@vger.kernel.org> [4.12+] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/swapfile.c1
1 files changed, 1 insertions, 0 deletions
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:
3291 spin_unlock(&swap_lock); 3291 spin_unlock(&swap_lock);
3292 vfree(swap_map); 3292 vfree(swap_map);
3293 kvfree(cluster_info); 3293 kvfree(cluster_info);
3294 kvfree(frontswap_map);
3294 if (swap_file) { 3295 if (swap_file) {
3295 if (inode && S_ISREG(inode->i_mode)) { 3296 if (inode && S_ISREG(inode->i_mode)) {
3296 inode_unlock(inode); 3297 inode_unlock(inode);