diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2017-09-08 19:13:25 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-09-08 21:26:47 -0400 |
commit | 8606a1a94da5c4e49c0fb28af62d2e75c6747716 (patch) | |
tree | a9b29670816e60689aa4fa30e2784f4fa3370af0 /mm/swapfile.c | |
parent | f19360f015d338a80bec4d56c2e4fc01680ffd8f (diff) |
mm: kvfree the swap cluster info if the swap file is unsatisfactory
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>
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>
Diffstat (limited to 'mm/swapfile.c')
-rw-r--r-- | mm/swapfile.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c index d483278ee35b..12251d386dc7 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -3290,7 +3290,7 @@ bad_swap: | |||
3290 | p->flags = 0; | 3290 | p->flags = 0; |
3291 | spin_unlock(&swap_lock); | 3291 | spin_unlock(&swap_lock); |
3292 | vfree(swap_map); | 3292 | vfree(swap_map); |
3293 | vfree(cluster_info); | 3293 | kvfree(cluster_info); |
3294 | if (swap_file) { | 3294 | if (swap_file) { |
3295 | if (inode && S_ISREG(inode->i_mode)) { | 3295 | if (inode && S_ISREG(inode->i_mode)) { |
3296 | inode_unlock(inode); | 3296 | inode_unlock(inode); |