Skip to content

Commit

Permalink
mm/swapfile.c: fix swapon frontswap_map memory leak on error
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rientjes authored and torvalds committed Sep 9, 2017
1 parent 8606a1a commit b6b1fd2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -3291,6 +3291,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
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);
Expand Down

0 comments on commit b6b1fd2

Please sign in to comment.