]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
mm: vmalloc: only zero-init on vrealloc shrink
authorKees Cook <kees@kernel.org>
Thu, 15 May 2025 21:42:16 +0000 (14:42 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 29 May 2025 09:14:06 +0000 (11:14 +0200)
commita89d47c63e8f608265cd4b1372b60e7bbbd74260
treee394f40601b4059ccd6401dd2a72c52b5cd2f1e5
parent237743fa643beb23773012e6f417456eadb8abd0
mm: vmalloc: only zero-init on vrealloc shrink

commit 70d1eb031a68cbde4eed8099674be21778441c94 upstream.

The common case is to grow reallocations, and since init_on_alloc will
have already zeroed the whole allocation, we only need to zero when
shrinking the allocation.

Link: https://lkml.kernel.org/r/20250515214217.619685-2-kees@kernel.org
Fixes: a0309faf1cb0 ("mm: vmalloc: support more granular vrealloc() sizing")
Signed-off-by: Kees Cook <kees@kernel.org>
Tested-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
Cc: Danilo Krummrich <dakr@kernel.org>
Cc: Eduard Zingerman <eddyz87@gmail.com>
Cc: "Erhard F." <erhard_f@mailbox.org>
Cc: Shung-Hsi Yu <shung-hsi.yu@suse.com>
Cc: "Uladzislau Rezki (Sony)" <urezki@gmail.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
mm/vmalloc.c