Commit 76bf6147 authored by David Rientjes's avatar David Rientjes Committed by Greg Kroah-Hartman

mm/swapfile.c: fix swapon frontswap_map memory leak on error

commit b6b1fd2a upstream.

Free frontswap_map if an error is encountered before enable_swap_info().
Signed-off-by: default avatarDavid Rientjes <rientjes@google.com>
Reviewed-by: default avatar"Huang, Ying" <ying.huang@intel.com>
Cc: Darrick J. Wong <darrick.wong@oracle.com>
Cc: Hugh Dickins <hughd@google.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 36f31cb6
...@@ -3053,6 +3053,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) ...@@ -3053,6 +3053,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
spin_unlock(&swap_lock); spin_unlock(&swap_lock);
vfree(swap_map); vfree(swap_map);
kvfree(cluster_info); kvfree(cluster_info);
kvfree(frontswap_map);
if (swap_file) { if (swap_file) {
if (inode && S_ISREG(inode->i_mode)) { if (inode && S_ISREG(inode->i_mode)) {
inode_unlock(inode); inode_unlock(inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment