summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2017-09-09 02:13:25 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-09-14 00:20:53 +0300
commit36f31cb67a9197bdaa251c822752cab7263ebeed (patch)
treed27ef37922d5c754bb406b2634ea168cc57f81a1 /mm
parentc7d1c698567caf9333a9e3d78f392d4495b9384a (diff)
downloadlinux-36f31cb67a9197bdaa251c822752cab7263ebeed.tar.xz
mm: kvfree the swap cluster info if the swap file is unsatisfactory
commit 8606a1a94da5c4e49c0fb28af62d2e75c6747716 upstream. If initializing a small swap file fails because the swap file has a problem (holes, etc.) then we need to free the cluster info as part of cleanup. Unfortunately a previous patch changed the code to use kvzalloc but did not change all the vfree calls to use kvfree. Found by running generic/357 from xfstests. Link: http://lkml.kernel.org/r/20170831233515.GR3775@magnolia Fixes: 54f180d3c181 ("mm, swap: use kvzalloc to allocate some swap data structures") Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: "Huang, Ying" <ying.huang@intel.com> Acked-by: David Rientjes <rientjes@google.com> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/swapfile.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 6ba4aab2db0b..c1deb0104b5f 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3052,7 +3052,7 @@ bad_swap:
p->flags = 0;
spin_unlock(&swap_lock);
vfree(swap_map);
- vfree(cluster_info);
+ kvfree(cluster_info);
if (swap_file) {
if (inode && S_ISREG(inode->i_mode)) {
inode_unlock(inode);