[RHEL7,COMMIT] ms/mm: kvfree the swap cluster info if the swap file is unsatisfactory

Submitted by Konstantin Khorenko on July 2, 2018, 10:17 a.m.


Message ID 201807021017.w62AHHQu001361@finist_ce7.work
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko July 2, 2018, 10:17 a.m.
The commit is pushed to "branch-rh7-3.10.0-862.3.2.vz7.61.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-862.3.2.vz7.61.7
commit 1258d99b8e510670b6a2e59c1f72e8a56090e8e6
Author: Darrick J. Wong <darrick.wong@oracle.com>
Date:   Mon Jul 2 13:17:17 2018 +0300

    ms/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>
    (cherry picked from commit 8606a1a94da5c4e49c0fb28af62d2e75c6747716)
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
 mm/swapfile.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/mm/swapfile.c b/mm/swapfile.c
index a174990d72b9..d69730691db2 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -2908,7 +2908,7 @@  SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags)
 	p->flags = 0;
-	vfree(cluster_info);
+	kvfree(cluster_info);
 	if (swap_file) {
 		if (inode && S_ISREG(inode->i_mode)) {