diff options
| author | Cole Leavitt <cole@unwrap.rs> | 2026-02-25 16:54:06 -0700 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2026-03-31 14:52:26 -0700 |
| commit | 2ddb69f686ef7a621645e97fc7329c50edf5d0e5 (patch) | |
| tree | 7e019930834b7002bc8a71add719fbb95ade1dd7 /Documentation/controllers/git@git.tavy.me:linux.git | |
| parent | b22462c79179f228327b98313b47369129114d6a (diff) | |
pstore/ram: fix resource leak when ioremap() fails
In persistent_ram_iomap(), ioremap() or ioremap_wc() may return NULL on
failure. Currently, if this happens, the function returns NULL without
releasing the memory region acquired by request_mem_region().
This leads to a resource leak where the memory region remains reserved
but unusable.
Additionally, the caller persistent_ram_buffer_map() handles NULL
correctly by returning -ENOMEM, but without this check, a NULL return
combined with request_mem_region() succeeding leaves resources in an
inconsistent state.
This is the ioremap() counterpart to commit 05363abc7625 ("pstore:
ram_core: fix incorrect success return when vmap() fails") which fixed
a similar issue in the vmap() path.
Fixes: 404a6043385d ("staging: android: persistent_ram: handle reserving and mapping memory")
Signed-off-by: Cole Leavitt <cole@unwrap.rs>
Link: https://patch.msgid.link/20260225235406.11790-1-cole@unwrap.rs
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'Documentation/controllers/git@git.tavy.me:linux.git')
0 files changed, 0 insertions, 0 deletions
