From patchwork Sun Jan 17 02:10:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 365444 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 34D45C4332B for ; Sun, 17 Jan 2021 02:11:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C85E22D05 for ; Sun, 17 Jan 2021 02:11:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727930AbhAQCLo (ORCPT ); Sat, 16 Jan 2021 21:11:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:41566 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727786AbhAQCLf (ORCPT ); Sat, 16 Jan 2021 21:11:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7FCB222D05; Sun, 17 Jan 2021 02:10:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1610849454; bh=LHSUh/fUQrExIhJtrdayIHHAUvh5yQ/wqLxsITVQcTI=; h=Date:From:To:Subject:From; b=k/YLJQ472cMVN+D7XDSCb8uKrm9ucbQKcXqshivc7xe5Uy7wD5NFM6p+8+m5fDW1O WRZrsWBz/MXGcs1VUSe+ZJiTI53V6r6ADmn8lzxuFDKeFoSr0ThymaaoA57yha/UnL dFN6NNQEE3eqSylusWlr864arwMoHILy22gkEPc8= Date: Sat, 16 Jan 2021 18:10:54 -0800 From: akpm@linux-foundation.org To: linmiaohe@huawei.com, luoshijie1@huawei.com, mm-commits@vger.kernel.org, stable@vger.kernel.org, urezki@gmail.com Subject: [merged] mm-vmallocc-fix-potential-memory-leak.patch removed from -mm tree Message-ID: <20210117021054.5BTRxoFeg%akpm@linux-foundation.org> User-Agent: s-nail v14.8.16 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch titled Subject: mm/vmalloc.c: fix potential memory leak has been removed from the -mm tree. Its filename was mm-vmallocc-fix-potential-memory-leak.patch This patch was dropped because it was merged into mainline or a subsystem tree ------------------------------------------------------ From: Miaohe Lin Subject: mm/vmalloc.c: fix potential memory leak In VM_MAP_PUT_PAGES case, we should put pages and free array in vfree. But we missed to set area->nr_pages in vmap(). So we would failed to put pages in __vunmap() because area->nr_pages = 0. Link: https://lkml.kernel.org/r/20210107123541.39206-1-linmiaohe@huawei.com Fixes: b944afc9d64d ("mm: add a VM_MAP_PUT_PAGES flag for vmap") Signed-off-by: Shijie Luo Signed-off-by: Miaohe Lin Reviewed-by: Uladzislau Rezki (Sony) Cc: Signed-off-by: Andrew Morton --- mm/vmalloc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/mm/vmalloc.c~mm-vmallocc-fix-potential-memory-leak +++ a/mm/vmalloc.c @@ -2420,8 +2420,10 @@ void *vmap(struct page **pages, unsigned return NULL; } - if (flags & VM_MAP_PUT_PAGES) + if (flags & VM_MAP_PUT_PAGES) { area->pages = pages; + area->nr_pages = count; + } return area->addr; } EXPORT_SYMBOL(vmap);