From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F92E18859B for ; Sun, 5 Jul 2026 00:49:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783212596; cv=none; b=D4gewMRxMUj46Sb3rBnH4w5YpwIBgRF0R6PgFEbKFnNh5/syM6pWTGPLxQNan0XETYJ8XfxYiRt0u1HJP0RODBHCM2/CfD8c0RtU2vLFznRunNYDgOn5CZ1xPXwJi2CFm0ud0ClKgcufDjGaAWiq2dgfJJsrzzX4111HYe8hURY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783212596; c=relaxed/simple; bh=eXWoK9PFIsO1CTrW0zprynJoHhESxXsw8XLCRHV8Pi8=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=gYBbL+NdRH7uwLeWN0STzs5tr5X0IuouuaWwyTLiM+KS+AKuUaMKI/OEQtbxvJfjtCSvnN0ZpCSxRZwF98r9fmy3SKeeRQ9xiVDI4ACG7eh9KRVVBQoWXyYnsO2x2o4Zm2PhLu2PMX3/RAmTOJaUmbe1jIwLHtk2mKXsMRy6hZg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=TM9584Co; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="TM9584Co" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 682DF1F000E9; Sun, 5 Jul 2026 00:49:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1783212594; bh=ZjSm4Fd+lNDKkVoVoHGYedDWV9KOmG3MTrqi+j5epJw=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=TM9584CoCVWiMFvcZyNQtjeivX2GDfDb6VcM7ie7sC1bRM16H4Aw3UyuMWq/Mi5aZ TvQIv1DaQXfV2Rzjrp6lHg5XVhv0UZf0WPxCpCvlwgxc53NBkeTeYUkWacRCo6tOtz iLz5AHcrgPwfhiKGztT9+tOBaD04R/bmyM5g7nRA= Date: Sat, 4 Jul 2026 17:49:53 -0700 From: Andrew Morton To: Sourav Panda Cc: muchun.song@linux.dev, osalvador@suse.de, david@kernel.org, surenb@google.com, fvdl@google.com, gthelen@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/hugetlb: Fix null nodemask in alloc_fresh_hugetlb_folio Message-Id: <20260704174953.002ee4990c62cec6bbfe4391@linux-foundation.org> In-Reply-To: <20260704174930.2885785-1-souravpanda@google.com> References: <20260704174930.2885785-1-souravpanda@google.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 4 Jul 2026 17:49:30 +0000 Sourav Panda wrote: > alloc_buddy_hugetlb_folio_with_mpol() can pass a NULL nodemask to > alloc_fresh_hugetlb_folio() as a fallback to allocate from all > nodes. If order is gigantic, alloc_fresh_hugetlb_folio() propagates > the NULL nodemask down to hugetlb_cma_alloc_frozen_folio() which blindly > dereferences it in for_each_node_mask(), leading to a null pointer > dereference. > > Similarly, if the CMA allocation fails, the fallback > alloc_contig_frozen_pages() is also called with a NULL nodemask, > which may cause issues. > > Fix this by explicitly checking if nodemask is NULL in > alloc_fresh_hugetlb_folio() and defaulting to > cpuset_current_mems_allowed. This ensures that both the CMA and > contiguous allocators receive a valid nodemask. > > Additionally, this patch adds a missing node_isset(nid, *nodemask) check > in hugetlb_cma_alloc_frozen_folio() to ensure the initial node allocation > attempt respects the memory policy. Thanks, bu the changelog still doesn't explain the userspace visible effects of the bug :( Important when proposing a cc:stable bugfix. So can you please condense and include the info you sent in reply to my v1 question? Also, Sashiko is saying stuff, as usual: https://sashiko.dev/#/patchset/20260704174930.2885785-1-souravpanda@google.com