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 69536391833; Sat, 12 Sep 2026 19:58:47 +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=1789243129; cv=none; b=UqobRhDOcg3BZVfYP55maaJkSgOvWkj4aASOSUE+zT15oRwIOdI3qT+mWVm/9DQgAUxhiIF8pDIIygoYmtBtxBpyfwcXL8doqsBTXxOIcKM+j3ymyP9osMGvefLInrkGvnRrjppRWjuehRGRjZOOW7TGmuGhXBzFDQXsvDWZo/I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789243129; c=relaxed/simple; bh=m0rSMAsjGJ2QQp+KYR6FtCUewMOrXpnpPbHgCVdl2fs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z7v3OM7dGfGWef6ApGOU6EXcY03oe3VfoHEz3JsZS0i+VtkRTlV8LxSdVBTNTdymjZ9W2ada9p2dtE/lwuKJ1fNCyEsBaLabzOe1hWqBfk4P5ynUUdjk4A/kvlAW8wZGtTuczC35HAAoW6saRBVfZ8yLtAjzIM5F9XeSIUcwxVI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=HdShupXM; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="HdShupXM" Received: by smtp.kernel.org (Postfix) with ESMTPSA id C919C1F000FF; Sat, 12 Sep 2026 19:58:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1789243126; bh=PHiTXNMyxP6quL56372HxUV1N9OYDdxpRjHT+21brHw=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=HdShupXMdB/QqmfUnyVdnwosM8AvrvUw1NTtaLvDbz3tWrFU6rz4nTDJlaeAWTx+E KmJzEd5skXioEEWFvtPY0/41fy6Fxc9OKrZuAs/CDmUCESgixeAPcecZ9Fm/9KnZ3f gTo98oLs3AQnHwkxso7VDwaMNUpP9l2yYfms02Ag= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yichong Chen , David Hildenbrand , Muchun Song , Oscar Salvador , Andrew Morton , Sasha Levin Subject: [PATCH 5.10 644/798] hugetlbfs: release subpool on fill_super failure Date: Sat, 12 Sep 2026 09:04:32 +0200 Message-ID: <20260912065531.876936797@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260912065516.948645775@linuxfoundation.org> References: <20260912065516.948645775@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yichong Chen [ Upstream commit 308ab73e97c87bd0e142b11758faab7f88d82854 ] hugetlbfs_fill_super() allocates a hugepage subpool when size or min_size mount options are specified. hugepage_new_subpool() may also reserve huge pages for min_size. If root dentry creation fails after the subpool is created, the failure path frees the subpool with kfree(). This bypasses hugepage_put_subpool() and can leave min_size reservations charged. Use hugepage_put_subpool() on the failure path, matching the normal put_super path. Link: https://lore.kernel.org/20260720021900.1376309-1-chenyichong@uniontech.com Fixes: 7ca02d0ae586 ("hugetlbfs: accept subpool min_size mount option and setup accordingly") Signed-off-by: Yichong Chen Cc: David Hildenbrand Cc: Muchun Song Cc: Oscar Salvador Signed-off-by: Andrew Morton Signed-off-by: Sasha Levin --- fs/hugetlbfs/inode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 306da7cb3d8b0..d2a3964daf70c 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -1393,7 +1393,8 @@ hugetlbfs_fill_super(struct super_block *sb, struct fs_context *fc) goto out_free; return 0; out_free: - kfree(sbinfo->spool); + if (sbinfo->spool) + hugepage_put_subpool(sbinfo->spool); kfree(sbinfo); return -ENOMEM; } -- 2.53.0