mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
pstore: don't leave an ERR_PTR in the ramoops zone pointer
ramoops_init_prz() stores the result of persistent_ram_new() in *prz and
returns the error without clearing it when initialization fails.
ramoops_probe() then cleans up through ramoops_free_przs(), which hands
*prz to persistent_ram_free(); that treats the ERR_PTR as a valid zone
and dereferences it, crashing the kernel.
Clear *prz before returning so that cleanup sees a NULL zone.
Fixes: b5d38e9bf1 ("pstore/ram: Add console messages handling")
Assisted-by: LLM
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
Link: https://patch.msgid.link/20260921202317.70595-2-parri.andrea@gmail.com
Signed-off-by: Kees Cook <kees@kernel.org>
This commit is contained in:
parent
df2908090c
commit
70fec428c8
|
|
@ -604,6 +604,7 @@ static int ramoops_init_prz(const char *name,
|
|||
if (IS_ERR(*prz)) {
|
||||
int err = PTR_ERR(*prz);
|
||||
|
||||
*prz = NULL;
|
||||
dev_err(dev, "failed to request %s mem region (0x%zx@0x%llx): %d\n",
|
||||
name, sz, (unsigned long long)*paddr, err);
|
||||
return err;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user