Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752674AbdILRB2 (ORCPT ); Tue, 12 Sep 2017 13:01:28 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49200 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752189AbdILRBY (ORCPT ); Tue, 12 Sep 2017 13:01:24 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , "Huang, Ying" , David Rientjes , Hugh Dickins , Andrew Morton , Linus Torvalds Subject: [PATCH 4.12 11/22] mm: kvfree the swap cluster info if the swap file is unsatisfactory Date: Tue, 12 Sep 2017 09:59:46 -0700 Message-Id: <20170912165302.455464654@linuxfoundation.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20170912165301.886822511@linuxfoundation.org> References: <20170912165301.886822511@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1384 Lines: 41 4.12-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. 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 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 @@ -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);