]> git.ipfire.org Git - thirdparty/linux.git/commit
pstore: ram_core: fix incorrect success return when vmap() fails
authorRuipeng Qi <ruipengqi3@gmail.com>
Tue, 3 Feb 2026 02:03:58 +0000 (10:03 +0800)
committerKees Cook <kees@kernel.org>
Sat, 7 Feb 2026 00:50:35 +0000 (16:50 -0800)
commit05363abc7625cf18c96e67f50673cd07f11da5e9
treeba70e97742bf28950f04bc9e5db02224b3aa411a
parent9448598b22c50c8a5bb77a9103e2d49f134c9578
pstore: ram_core: fix incorrect success return when vmap() fails

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>
fs/pstore/ram_core.c