]> www.infradead.org Git - users/dwmw2/linux.git/commit
mm: vmalloc: check if a hash-index is in cpu_possible_mask
authorUladzislau Rezki (Sony) <urezki@gmail.com>
Wed, 26 Jun 2024 14:03:30 +0000 (16:03 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 4 Jul 2024 05:40:36 +0000 (22:40 -0700)
commita34acf30b19bc4ee3ba2f1082756ea2604c19138
tree4d6a2f856ef7f0be6b085f6c7ff29dc1aa9d7c02
parent82f0b6f041fad768c28b4ad05a683065412c226e
mm: vmalloc: check if a hash-index is in cpu_possible_mask

The problem is that there are systems where cpu_possible_mask has gaps
between set CPUs, for example SPARC.  In this scenario addr_to_vb_xa()
hash function can return an index which accesses to not-possible and not
setup CPU area using per_cpu() macro.  This results in an oops on SPARC.

A per-cpu vmap_block_queue is also used as hash table, incorrectly
assuming the cpu_possible_mask has no gaps.  Fix it by adjusting an index
to a next possible CPU.

Link: https://lkml.kernel.org/r/20240626140330.89836-1-urezki@gmail.com
Fixes: 062eacf57ad9 ("mm: vmalloc: remove a global vmap_blocks xarray")
Reported-by: Nick Bowler <nbowler@draconx.ca>
Closes: https://lore.kernel.org/linux-kernel/ZntjIE6msJbF8zTa@MiWiFi-R3L-srv/T/
Signed-off-by: Uladzislau Rezki (Sony) <urezki@gmail.com>
Reviewed-by: Baoquan He <bhe@redhat.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Hailong.Liu <hailong.liu@oppo.com>
Cc: Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vmalloc.c