linux/fs/pstore
Ruipeng Qi 49918dd526 pstore: ram_core: fix incorrect success return when vmap() fails
[ Upstream commit 05363abc76 ]

In persistent_ram_vmap(), vmap() may return NULL on failure.

If offset is non-zero, adding offset_in_page(start) causes the function
to return a non-NULL pointer even though the mapping failed.
persistent_ram_buffer_map() therefore incorrectly returns success.

Subsequent access to prz->buffer may dereference an invalid address
and cause crashes.

Add proper NULL checking for vmap() failures.

Signed-off-by: Ruipeng Qi <ruipengqi3@gmail.com>
Link: https://patch.msgid.link/20260203020358.3315299-1-ruipengqi3@gmail.com
Signed-off-by: Kees Cook <kees@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-03-04 07:20:01 -05:00
..
blk.c pstore/blk: trivial typo fixes 2025-03-13 12:49:51 +01:00
ftrace.c ftrace: Have the callbacks receive a struct ftrace_regs instead of pt_regs 2020-11-13 12:14:55 -05:00
inode.c pstore: Fix warning in pstore_kill_sb() 2021-02-23 09:27:20 -08:00
internal.h pstore: Move kmsg_bytes default into Kconfig 2020-12-01 12:09:17 -08:00
Kconfig pstore: Make sure CONFIG_PSTORE_PMSG selects CONFIG_RT_MUTEXES 2022-12-31 13:14:45 +01:00
Makefile pstore/blk: Introduce backend for block devices 2020-05-30 10:34:03 -07:00
platform.c pstore/platform: Add check for kstrdup 2023-11-20 11:08:13 +01:00
pmsg.c pstore: Revert pmsg_lock back to a normal mutex 2023-05-11 23:00:31 +09:00
ram.c pstore/ram: Fix crash when setting number of cpus to an odd number 2024-02-23 08:54:39 +01:00
ram_core.c pstore: ram_core: fix incorrect success return when vmap() fails 2026-03-04 07:20:01 -05:00
zone.c pstore/zone: Add a null pointer check to the psz_kmsg_read 2024-04-13 13:01:43 +02:00