diff options
| author | Ritesh Harjani (IBM) <[email protected]> | 2024-11-13 14:19:54 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2024-11-15 06:49:19 +0000 |
| commit | 2532e6c74a67e65b95f310946e0c0e0a41b3a34b (patch) | |
| tree | 5e884677ee6df8ea21f441803a7452c4f3fbeae9 /mm/filemap.c | |
| parent | mm/kfence: add a new kunit test test_use_after_free_read_nofault() (diff) | |
| download | kernel-2532e6c74a67e65b95f310946e0c0e0a41b3a34b.tar.gz kernel-2532e6c74a67e65b95f310946e0c0e0a41b3a34b.zip | |
cma: enforce non-zero pageblock_order during cma_init_reserved_mem()
cma_init_reserved_mem() checks base and size alignment with
CMA_MIN_ALIGNMENT_BYTES. However, some users might call this during early
boot when pageblock_order is 0. That means if base and size does not have
pageblock_order alignment, it can cause functional failures during cma
activate area.
So let's enforce pageblock_order to be non-zero during
cma_init_reserved_mem() to catch such wrong usages.
1. This was seen with fadump on PowerPC which was calling
cma_init_reserved_mem() before the pageblock_order was initialized.
This is now fixed in the fadump on PowerPC itself. The details of that
can be found in the patch including the userspace-visible effect of the
issue [1].
2. However it was also decided that we should add a stronger
enforcement check within cma_init_reserved_mem() to catch such wrong
usages [2]. Hence this patch. This is ok to be in -next and there is
no "Fixes" tag required for this patch.
[1]: https://lore.kernel.org/all/3ae208e48c0d9cefe53d2dc4f593388067405b7d.1729146153.git.ritesh.list@gmail.com/
[2]: https://lore.kernel.org/all/[email protected]/
Link: https://lkml.kernel.org/r/e274344b44d5f80fa54c52f530387257fe99ec65.1731505681.git.ritesh.list@gmail.com
Signed-off-by: Ritesh Harjani (IBM) <[email protected]>
Acked-by: David Hildenbrand <[email protected]>
Acked-by: Zi Yan <[email protected]>
Reviewed-by: Anshuman Khandual <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'mm/filemap.c')
0 files changed, 0 insertions, 0 deletions
