linux/fs/pstore
Ruipeng Qi 2c99326dc1 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:19:43 -05:00
..
blk.c pstore/blk: trivial typo fixes 2025-01-08 14:38:33 -08:00
ftrace.c pstore/ftrace: Allow immediate recording 2021-11-18 10:29:52 -08:00
inode.c fs: rename generic_delete_inode() and generic_drop_inode() 2025-09-15 16:09:42 +02:00
internal.h pstore: Change kmsg_bytes storage size to u32 2025-02-10 09:02:14 -08:00
Kconfig pstore: Replace crypto API compression with zlib_deflate library calls 2023-07-17 16:08:58 -07:00
Makefile pstore/blk: Introduce backend for block devices 2020-05-30 10:34:03 -07:00
platform.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
pmsg.c pstore update for v6.4-rc1 2023-04-27 17:03:40 -07:00
ram.c Get rid of 'remove_new' relic from platform driver struct 2024-12-01 15:12:43 -08:00
ram_core.c pstore: ram_core: fix incorrect success return when vmap() fails 2026-03-04 07:19:43 -05:00
ram_internal.h pstore/ram: Set freed addresses to NULL 2022-10-19 09:25:39 -07:00
zone.c pstore/zone: rewrite some comments for better understanding 2025-05-09 12:09:58 -07:00