Skip to contentSkip to conversation

Patch "mm: kvfree the swap cluster info if the swap file is unsatisfactory" has been added to the 4.12-stable tree

PATCH [email protected] 1 participant 1 message Sep 10, 2017

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

mm: kvfree the swap cluster info if the swap file is unsatisfactory

to the 4.12-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mm-kvfree-the-swap-cluster-info-if-the-swap-file-is-unsatisfactory.patch
and it can be found in the queue-4.12 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 8606a1a94da5c4e49c0fb28af62d2e75c6747716 Mon Sep 17 00:00:00 2001

From: "Darrick J. Wong" <[email protected]>
Date: Fri, 8 Sep 2017 16:13:25 -0700
Subject: mm: kvfree the swap cluster info if the swap file is unsatisfactory

From: Darrick J. Wong <[email protected]>

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.

---
 mm/swapfile.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/swapfile.c +1 -1
@@ -2903,7 +2903,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);

Patches currently in stable-queue which might be from [email protected] are

queue-4.12/mm-swapfile.c-fix-swapon-frontswap_map-memory-leak-on-error.patch queue-4.12/mm-kvfree-the-swap-cluster-info-if-the-swap-file-is-unsatisfactory.patch