From patchwork Mon Jul 12 06:12:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 473822 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BDCB5C11F70 for ; Mon, 12 Jul 2021 07:29:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id ABE4E6108B for ; Mon, 12 Jul 2021 07:29:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242936AbhGLHbq (ORCPT ); Mon, 12 Jul 2021 03:31:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:43826 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344496AbhGLH3e (ORCPT ); Mon, 12 Jul 2021 03:29:34 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5B1F061476; Mon, 12 Jul 2021 07:25:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074728; bh=4WzWwSqnXFdPLrSyvC+Li8flyQcLnlavMpv+y5OajME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=typcgW6cK4oAiAvdzOAn9WEUFPxEdS8dO+I/L1oNONVFPi6WYTMj1ZhZS4gnmao7u BGq39pKDY1K2Gfzi1TIdcQf00QOEaLGsyECVFa7XVTkSJ0KeCokI2U5a26UC940tAx kWeDWQ+6NfwRmeXNkDHcscTHD3ZUpn+q1kPCSgYw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miaohe Lin , Vitaly Wool , Hillf Danton , Andrew Morton , Linus Torvalds , Sasha Levin Subject: [PATCH 5.12 670/700] mm/z3fold: fix potential memory leak in z3fold_destroy_pool() Date: Mon, 12 Jul 2021 08:12:33 +0200 Message-Id: <20210712061047.180418873@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Miaohe Lin [ Upstream commit dac0d1cfda56472378d330b1b76b9973557a7b1d ] There is a memory leak in z3fold_destroy_pool() as it forgets to free_percpu pool->unbuddied. Call free_percpu for pool->unbuddied to fix this issue. Link: https://lkml.kernel.org/r/20210619093151.1492174-6-linmiaohe@huawei.com Fixes: d30561c56f41 ("z3fold: use per-cpu unbuddied lists") Signed-off-by: Miaohe Lin Reviewed-by: Vitaly Wool Cc: Hillf Danton Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- mm/z3fold.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/z3fold.c b/mm/z3fold.c index 9d889ad2bb86..56a5551f2ba8 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -1059,6 +1059,7 @@ static void z3fold_destroy_pool(struct z3fold_pool *pool) destroy_workqueue(pool->compact_wq); destroy_workqueue(pool->release_wq); z3fold_unregister_migration(pool); + free_percpu(pool->unbuddied); kfree(pool); }