All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH for-4.10] pstore: don't OOPS when there are no ftrace zones
@ 2017-02-09  6:44 Brian Norris
  2017-02-09 19:54 ` Kees Cook
  0 siblings, 1 reply; 4+ messages in thread
From: Brian Norris @ 2017-02-09  6:44 UTC (permalink / raw)
  To: Anton Vorontsov, Colin Cross, Kees Cook, Tony Luck
  Cc: linux-kernel, Brian Norris, Joel Fernandes

We'll OOPS in ramoops_get_next_prz() if the platform didn't ask for any
ftrace zones (i.e., cxt->fprzs will be NULL). Let's just skip this
entire FTRACE section if there's no 'fprzs'.

Regression seen on a coreboot/depthcharge-based Chromebook.

Fixes: 2fbea82bbb89 ("pstore: Merge per-CPU ftrace records into one")
Cc: Joel Fernandes <joelaf@google.com>
Cc: Kees Cook <keescook@chromium.org>
Signed-off-by: Brian Norris <briannorris@chromium.org>
---
Sorry for the late notice, but I just booted 4.10 on a Chromebook. This also
may not be the "perfect" fix, but it's what I scrounged up in 5 minutes today.

 fs/pstore/ram.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 27c059e1760a..1d887efaaf71 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -280,7 +280,7 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
 					   1, id, type, PSTORE_TYPE_PMSG, 0);
 
 	/* ftrace is last since it may want to dynamically allocate memory. */
-	if (!prz_ok(prz)) {
+	if (!prz_ok(prz) && cxt->fprzs) {
 		if (!(cxt->flags & RAMOOPS_FLAG_FTRACE_PER_CPU)) {
 			prz = ramoops_get_next_prz(cxt->fprzs,
 					&cxt->ftrace_read_cnt, 1, id, type,
-- 
2.11.0.483.g087da7b7c-goog

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-02-09 23:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-09  6:44 [PATCH for-4.10] pstore: don't OOPS when there are no ftrace zones Brian Norris
2017-02-09 19:54 ` Kees Cook
2017-02-09 23:04   ` [PATCH] pstore: unconditionally initialize spinlock and flags Brian Norris
2017-02-09 23:49     ` Kees Cook

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.