[lkml]   [2017]   [Sep]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 4.13 15/27] mm: kvfree the swap cluster info if the swap file is unsatisfactory
4.13-stable review patch.  If anyone has any objections, please let me know.


From: Darrick J. Wong <>

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.

Fixes: 54f180d3c181 ("mm, swap: use kvzalloc to allocate some swap data structures")
Signed-off-by: Darrick J. Wong <>
Reviewed-by: "Huang, Ying" <>
Acked-by: David Rientjes <>
Cc: Hugh Dickins <>
Signed-off-by: Andrew Morton <>
Signed-off-by: Linus Torvalds <>
Signed-off-by: Greg Kroah-Hartman <>

mm/swapfile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -3052,7 +3052,7 @@ bad_swap:
p->flags = 0;
- vfree(cluster_info);
+ kvfree(cluster_info);
if (swap_file) {
if (inode && S_ISREG(inode->i_mode)) {

 \ /
  Last update: 2017-09-12 19:05    [W:0.149 / U:10.016 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site