pstore/ram: Improve backward compatibility with older Chromebooks
authorDouglas Anderson <dianders@chromium.org>
Wed, 8 May 2019 15:48:31 +0000 (08:48 -0700)
committerKees Cook <keescook@chromium.org>
Tue, 9 Jul 2019 04:04:42 +0000 (21:04 -0700)
commit1614e92179abe91283fc397c37f6244fe0019072
tree3cb22d9480158383f2a5783a35db594922033300
parentd1fdb6d8f6a4109a4263176c84b899076a5f8008
pstore/ram: Improve backward compatibility with older Chromebooks

When you try to run an upstream kernel on an old ARM-based Chromebook
you'll find that console-ramoops doesn't work.

Old ARM-based Chromebooks, before <https://crrev.com/c/439792>
("ramoops: support upstream {console,pmsg,ftrace}-size properties")
used to create a "ramoops" node at the top level that looked like:

/ {
  ramoops {
    compatible = "ramoops";
    reg = <...>;
    record-size = <...>;
    dump-oops;
  };
};

...and these Chromebooks assumed that the downstream kernel would make
console_size / pmsg_size match the record size.  The above ramoops
node was added by the firmware so it's not easy to make any changes.

Let's match the expected behavior, but only for those using the old
backward-compatible way of working where ramoops is right under the
root node.

NOTE: if there are some out-of-tree devices that had ramoops at the
top level, left everything but the record size as 0, and somehow
doesn't want this behavior, we can try to add more conditions here.

Signed-off-by: Douglas Anderson <dianders@chromium.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/ram.c