From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751915AbdHaXf0 (ORCPT ); Thu, 31 Aug 2017 19:35:26 -0400 Received: from aserp1040.oracle.com ([141.146.126.69]:37430 "EHLO aserp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751307AbdHaXfY (ORCPT ); Thu, 31 Aug 2017 19:35:24 -0400 Date: Thu, 31 Aug 2017 16:35:15 -0700 From: "Darrick J. Wong" To: akpm@linux-foundation.org, ying.huang@intel.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] mm: kvfree the swap cluster info if the swap file is unsatisfactory Message-ID: <20170831233515.GR3775@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.24 (2015-08-30) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Darrick J. Wong --- mm/swapfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 6ba4aab..c1deb01 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -3052,7 +3052,7 @@ SYSCALL_DEFINE2(swapon, const char __user *, specialfile, int, swap_flags) 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);