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 4068035C695; Wed, 9 Sep 2026 06:28:46 +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=1788935328; cv=none; b=q2mXhqNXJyTCIUlyL5i0iaTlCXqfZ+965Epw5vUH79EKFHVep9kFVDfpiNhR9CPlw+qN0QXrP6EFu8WTz+XTSwwJJKnOSDh1L/8NKNdTTcG2jobRTJZ0Om7OsiG/XYIV9B2Y/k0sE0Cf2JvYZnAyMHgK70oKQgfZoYJri7GEj6U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788935328; c=relaxed/simple; bh=gLHIkh9BpZwcVrEU6pQDyK+XKjaOp6d+OUll/Tehm/g=; h=Date:To:From:Subject:Message-Id; b=O7EldpnBfefyIH0T1eGa8CKpl8rmfFgTsFmRnxwwQejCWU9dK/Vjc2m8rLoqFicqndjyjkRZEWkDFbJiuAhk/C+CLD5xhEabsZOQ3WZiDk9V25UOA6kPPavrHV28R/8ysCNhU1BGE9KrpAtlKK09nXHuZh+aMzJzCUlu26jQobw= 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=wO0UVm6V; 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="wO0UVm6V" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84FED1F00A3A; Wed, 9 Sep 2026 06:28:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=korg; t=1788935326; bh=eYwi4tNpzrN8Y09NVGaTLmbUE4I536ciMBM9HR2Amfw=; h=Date:To:From:Subject; b=wO0UVm6VWFzVWSUzmSEYG6QJIlq+9QeywZGiwgNf5gw4d3f6tYbsI/9r02Xha1CXM 0W0X2nmmhJid9fG7V+tiVEsSbmcztmUzhiSGPcrYJE7rlDcHW8t+5PWoMt4HU+q4y8 Yb7TOkpCWPlGDh1JB1aXGXgIoMmfr7dUdBjMvPDw= Date: Tue, 08 Sep 2026 23:28:46 -0700 To: mm-commits@vger.kernel.org,vbabka@kernel.org,stable@vger.kernel.org,pfalcato@suse.de,liam@infradead.org,jannh@google.com,ljs@kernel.org,akpm@linux-foundation.org From: Andrew Morton Subject: [merged mm-hotfixes-stable] mm-vma-correctly-unaccount-on-mmap_prepare-failure.patch removed from -mm tree Message-Id: <20260909062846.84FED1F00A3A@smtp.kernel.org> Precedence: bulk X-Mailing-List: mm-commits@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: The quilt patch titled Subject: mm/vma: correctly unaccount on mmap_prepare() failure has been removed from the -mm tree. Its filename was mm-vma-correctly-unaccount-on-mmap_prepare-failure.patch This patch was dropped because it was merged into the mm-hotfixes-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm ------------------------------------------------------ From: "Lorenzo Stoakes (ARM)" Subject: mm/vma: correctly unaccount on mmap_prepare() failure Date: Wed, 02 Sep 2026 19:08:08 +0100 __mmap_setup() accounts memory for relevant mappings via: security_vm_enough_memory_mm() -> __vm_enough_memory() -> vm_acct_memory() If __mmap_setup() fails, this indicates that this accounting did not take place, and thus it's appropriate for __mmap_region() to jump to abort_munmap. However if call_mmap_prepare() fails, it also jumps there and any accounted memory is not correctly unaccounted. Fix this by handling each error separately. Link: https://lore.kernel.org/20260902-fix-unaccount-mmap_prepare-v1-1-ea070189fdfb@kernel.org Fixes: c84bf6dd2b83 ("mm: introduce new .mmap_prepare() file callback") Signed-off-by: Lorenzo Stoakes (ARM) Cc: Jann Horn Cc: Liam R. Howlett Cc: Pedro Falcato Cc: Vlastimil Babka Cc: Signed-off-by: Andrew Morton --- mm/vma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/mm/vma.c~mm-vma-correctly-unaccount-on-mmap_prepare-failure +++ a/mm/vma.c @@ -2859,10 +2859,12 @@ static unsigned long __mmap_region(struc map.check_ksm_early = can_set_ksm_flags_early(&map); error = __mmap_setup(&map, &desc, uf); - if (!error && have_mmap_prepare) - error = call_mmap_prepare(&map, &desc); if (error) goto abort_munmap; + if (have_mmap_prepare) + error = call_mmap_prepare(&map, &desc); + if (error) + goto unacct_error; if (map.check_ksm_early) update_ksm_flags(&map); _ Patches currently in -mm which might be from ljs@kernel.org are mm-vmpressure-remove-window-size-todo.patch tools-testing-selftests-mm-add-missing-gitignore-entries.patch mm-move-drivers-char-memc-to-mm-char-memc.patch mm-implement-file_is_dev_zero-to-uniquely-identify-dev-zero.patch mm-vma-only-permit-map_private-dev-zero-to-be-mapped-anonymous.patch mm-vma-make-map_private-mapped-dev-zero-mappings-truly-anonymous.patch tools-testing-vma-add-test-to-assert-map_private-dev-zero-is-anon.patch tools-testing-selftests-mm-add-map_private-dev-zero-merge-tests.patch mm-madvise-swap-in-cowd-map_private-file-mappings-on-madv_willneed.patch mm-huge_memory-zap-deposited-page-tables-after-an-rcu-grace-period.patch mm-enable-mmu_gather_rcu_table_free-for-most-2-level-architectures.patch mm-enable-mmu_gather_rcu_table_free-for-mmu-riscv.patch mm-enable-mmu_gather_rcu_table_free-for-mmu-arm.patch mm-enable-mmu_gather_rcu_table_free-for-arc-microblaze-xtensa.patch mm-enable-mmu_gather_rcu_table_free-for-sparc64.patch mm-enable-mmu_gather_rcu_table_free-for-m68k-coldfire.patch mm-enable-mmu_gather_rcu_table_free-for-sh-x2.patch mm-enable-mmu_gather_rcu_table_free-for-m68k-motorola.patch mm-enable-mmu_gather_rcu_table_free-for-sparc32.patch mm-make-userland-page-table-freeing-rcu-safe.patch mm-change-the-contract-for-free_pgtables-update-docs.patch