Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752327AbdILRAr (ORCPT ); Tue, 12 Sep 2017 13:00:47 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49062 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752560AbdILRAh (ORCPT ); Tue, 12 Sep 2017 13:00:37 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Rientjes , "Huang, Ying" , "Darrick J. Wong" , Hugh Dickins , Andrew Morton , Linus Torvalds Subject: [PATCH 4.12 12/22] mm/swapfile.c: fix swapon frontswap_map memory leak on error Date: Tue, 12 Sep 2017 09:59:47 -0700 Message-Id: <20170912165302.492677941@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: 957 Lines: 33 4.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Rientjes commit b6b1fd2a6bedd533aeed83924d7be0e944fded9f upstream. Free frontswap_map if an error is encountered before enable_swap_info(). Signed-off-by: David Rientjes Reviewed-by: "Huang, Ying" Cc: Darrick J. Wong Cc: Hugh Dickins Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/swapfile.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/swapfile.c +++ b/mm/swapfile.c @@ -2904,6 +2904,7 @@ bad_swap: spin_unlock(&swap_lock); vfree(swap_map); kvfree(cluster_info); + kvfree(frontswap_map); if (swap_file) { if (inode && S_ISREG(inode->i_mode)) { inode_unlock(inode);