From mboxrd@z Thu Jan 1 00:00:00 1970 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=-14.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 157AEC433DB for ; Mon, 29 Mar 2021 17:40:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7700561879 for ; Mon, 29 Mar 2021 17:40:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7700561879 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D9E316B007D; Mon, 29 Mar 2021 13:40:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D74AB6B007E; Mon, 29 Mar 2021 13:40:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C3C2D6B0080; Mon, 29 Mar 2021 13:40:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id A8EE46B007D for ; Mon, 29 Mar 2021 13:40:39 -0400 (EDT) Received: from smtpin33.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 63A9B180AD822 for ; Mon, 29 Mar 2021 17:40:39 +0000 (UTC) X-FDA: 77973626598.33.14D3AFC Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) by imf20.hostedemail.com (Postfix) with ESMTP id B29AB3CA for ; Mon, 29 Mar 2021 17:40:30 +0000 (UTC) Received: by mail-lf1-f46.google.com with SMTP id g8so19668102lfv.12 for ; Mon, 29 Mar 2021 10:40:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:date:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=dG/fDVlRANUKzxqs96ttVjSvp1RnJE01JtgwpiYp5OQ=; b=e0jLrdsbKxVG48pYt7iAQGZucoca/DINeaYlEkj1ohC0O4iX6NSzuwcnGbwUIqf78t +5aKfrFTW496gMzjemxHCEQU25vVyEDmHCdI3pj+LmUlVQLhHJQh+TmSCUyR2YtqIMFo gs5fwJseylaM9kFxNqEyWa4z+1bPYXBBJiORajXTgLmAdIiOr73wZL9pM36KT70l51p/ E+5YtfTdF5eb3WBCy7Tb+WsrTu5WQX3Sg5xMpE5cnr5ou/xIKtDKcq7S6pZBIysWwdjh qN9GKGe5+IZyLLU2rG/v1NnLZMZs8nLxJPlq9QKabt8s4xaN7aOLHEyZ8Ya3rvK9uROw 9pBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:date:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=dG/fDVlRANUKzxqs96ttVjSvp1RnJE01JtgwpiYp5OQ=; b=JtKIbAfvheHol2z72IAFUBJVgLBfUdBJAC6+DxkAKrzkTD0yxv1PN1tnM2ZRGG+stA L/Pbhu7UjonUvzDZEv/Y+tzK5hnTiN06gs8NR3bogMAvsAknvu8guQw+f6arGn2l3/8A kAOqz0oazM7NMPvDPGHK95Rtyvs45KSHhCbK3PLpULsa95S1+NdNCrietv/dixtkFJ2S 4dHpHDNJ+hvZZuQK8ZitLHfIMPSEpHZTLlXrp7akfHiKSINDbkqEJJLemaIDNDK4u21N ytyzU/m2uC3jT0pAb+sICmKtw4878rlA0HEb9EDVpRZIyxwXKSICWLBqrPJmR2owmPfW G2Mg== X-Gm-Message-State: AOAM530i7foN/l08aeonAc4qjUD3e7lqTlOH/5a8OQL4Q1PE8kizGHGM +i+kPg08QCIRgFdj7PZgCUY= X-Google-Smtp-Source: ABdhPJy2nwSd+qCv4LF8DeImyrM1BZPFbgWtI0tyhbrjbzPP4T/D2coD0TOYb2y+8jICMEOFWqs5bQ== X-Received: by 2002:a05:6512:2016:: with SMTP id a22mr17198967lfb.645.1617039631530; Mon, 29 Mar 2021 10:40:31 -0700 (PDT) Received: from pc638.lan (h5ef52e3d.seluork.dyn.perspektivbredband.net. [94.245.46.61]) by smtp.gmail.com with ESMTPSA id f15sm1902605lfr.51.2021.03.29.10.40.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 10:40:31 -0700 (PDT) From: Uladzislau Rezki X-Google-Original-From: Uladzislau Rezki Date: Mon, 29 Mar 2021 19:40:29 +0200 To: Matthew Wilcox , Colin King Cc: Colin King , Andrew Morton , Stephen Rothwell , Nicholas Piggin , linux-mm@kvack.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][next] mm/vmalloc: Fix read of pointer area after it has been free'd Message-ID: <20210329174029.GA457@pc638.lan> References: <20210329170730.121943-1-colin.king@canonical.com> <20210329171434.GH351017@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210329171434.GH351017@casper.infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: B29AB3CA X-Stat-Signature: dc94fh3h54n841d8mm9jh3eqwrurnmrk Received-SPF: none (gmail.com>: No applicable sender policy available) receiver=imf20; identity=mailfrom; envelope-from=""; helo=mail-lf1-f46.google.com; client-ip=209.85.167.46 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1617039630-606371 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Mar 29, 2021 at 06:14:34PM +0100, Matthew Wilcox wrote: > On Mon, Mar 29, 2021 at 06:07:30PM +0100, Colin King wrote: > > From: Colin Ian King > > > > Currently the memory pointed to by area is being freed by the > > free_vm_area call and then area->nr_pages is referencing the > > free'd object. Fix this swapping the order of the warn_alloc > > message and the free. > > > > Addresses-Coverity: ("Read from pointer after free") > > Fixes: 014ccf9b888d ("mm/vmalloc: improve allocation failure error messages") > > i don't have this git sha. if this is -next, the sha ids aren't stable > and shouldn't be referenced in commit logs, because these fixes should > just be squashed into the not-yet-upstream commits. > > > Signed-off-by: Colin Ian King > > --- > > mm/vmalloc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/mm/vmalloc.c b/mm/vmalloc.c > > index b73e4e715e0d..7936405749e4 100644 > > --- a/mm/vmalloc.c > > +++ b/mm/vmalloc.c > > @@ -2790,11 +2790,11 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask, > > } > > > > if (!pages) { > > - free_vm_area(area); > > warn_alloc(gfp_mask, NULL, > > "vmalloc size %lu allocation failure: " > > "page array size %lu allocation failed", > > area->nr_pages * PAGE_SIZE, array_size); > > + free_vm_area(area); > > return NULL; > > this fix looks right to me. > That is from the linux-next. Same to me. Reviewed-by: Uladzislau Rezki (Sony) -- Vlad Rezki