From: Andrea Parri <parri.andrea@gmail.com>
To: Kees Cook <kees@kernel.org>, Tony Luck <tony.luck@intel.com>,
"Guilherme G . Piccoli" <gpiccoli@igalia.com>,
Anton Vorontsov <anton.vorontsov@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Colin Cross <ccross@android.com>,
John Stultz <john.stultz@linaro.org>
Cc: linux-kernel@vger.kernel.org,
Andrea Parri <parri.andrea@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH 1/2] pstore: don't leave an ERR_PTR in the ramoops zone pointer
Date: Mon, 21 Sep 2026 22:23:15 +0200 [thread overview]
Message-ID: <20260921202317.70595-2-parri.andrea@gmail.com> (raw)
In-Reply-To: <20260921202317.70595-1-parri.andrea@gmail.com>
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: b5d38e9bf1b0c ("pstore/ram: Add console messages handling")
Cc: stable@vger.kernel.org
Assisted-by: LLM
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
---
fs/pstore/ram.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 2eb0d4fa21869..aa056d0395a4d 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -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;
--
2.53.0
next prev parent reply other threads:[~2026-09-21 20:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 20:23 [PATCH 0/2] pstore: fix two ramoops error-path bugs Andrea Parri
2026-09-21 20:23 ` Andrea Parri [this message]
2026-09-21 20:23 ` [PATCH 2/2] pstore: reject persistent RAM zones too small for the buffer header Andrea Parri
2026-09-21 21:35 ` Kees Cook
2026-09-21 22:38 ` Andrea Parri
2026-09-21 23:11 ` Kees Cook
2026-09-21 21:38 ` [PATCH 0/2] pstore: fix two ramoops error-path bugs Kees Cook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260921202317.70595-2-parri.andrea@gmail.com \
--to=parri.andrea@gmail.com \
--cc=anton.vorontsov@linaro.org \
--cc=ccross@android.com \
--cc=gpiccoli@igalia.com \
--cc=gregkh@linuxfoundation.org \
--cc=john.stultz@linaro.org \
--cc=kees@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®