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=-16.0 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,NICE_REPLY_A,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 6F441C433DB for ; Thu, 7 Jan 2021 23:15:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3BABE23601 for ; Thu, 7 Jan 2021 23:15:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728940AbhAGXPo (ORCPT ); Thu, 7 Jan 2021 18:15:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:53498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725944AbhAGXPo (ORCPT ); Thu, 7 Jan 2021 18:15:44 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 41AF023435; Thu, 7 Jan 2021 23:15:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1610061303; bh=6WmSpRAgxw55H+AbxkHQPUr//pcs3FzD3Dgc0jvHpXw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jVO+iKiakCwJHdLcs3X8bz8PCIMIF+quXTAHHEJqc3zGiprIGvqp9ebHqiP3i3u7K d9BFYpD4aZg2meEtFCUljyYuNEVF1CZtrUcS7/G5u19RjVU25X9ADoAJWnDjfyfmRl XOfmQ6w2eGvcvUBMgFrzSVjA/fnmyczYEA+WYZio= Date: Thu, 7 Jan 2021 15:15:02 -0800 From: Andrew Morton To: Mike Kravetz Cc: Miaohe Lin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/hugetlb: Fix potential double free in hugetlb_register_node() error path Message-Id: <20210107151502.7c581d98078ba90e63553dd4@linux-foundation.org> In-Reply-To: References: <20210107123249.36964-1-linmiaohe@huawei.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 7 Jan 2021 11:59:38 -0800 Mike Kravetz wrote: > On 1/7/21 4:32 AM, Miaohe Lin wrote: > > In hugetlb_sysfs_add_hstate(), we would do kobject_put() on hstate_kobjs > > when failed to create sysfs group but forget to set hstate_kobjs to NULL. > > Then in hugetlb_register_node() error path, we may free it again via > > hugetlb_unregister_node(). > > > > Fixes: a3437870160c ("hugetlb: new sysfs interface") > > Signed-off-by: Miaohe Lin > > Cc: > > --- > > mm/hugetlb.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > Thanks, this is a potential issue that should be fixed. > > Reviewed-by: Mike Kravetz > > This has been around for a long time (more than 12 years). I suspect > nobody actually experienced this issue. You just discovered via code > inspection. Correct? > At one time cc stable would not be accepted for this type of issue, > not sure about today. sysfs_create_group() will only fail if something is terribly messed up - probably it has never happened to anyone. I don't think the cc:stable is justified here.