]> git.baikalelectronics.ru Git - kernel.git/commit
pstore/ram: Fix console ramoops to show the previous boot logs
authorSai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Thu, 17 Jan 2019 17:09:29 +0000 (09:09 -0800)
committerKees Cook <keescook@chromium.org>
Thu, 17 Jan 2019 17:14:06 +0000 (09:14 -0800)
commitf75b7d3fac48897e535a1190d63939fac27daa22
tree265219a72967ef405a7c0dcc38a57c6047893cd5
parent5ada4c1885c3ebec7f8758c3968a4b57e1d3dc0e
pstore/ram: Fix console ramoops to show the previous boot logs

commit 6fea810ab2c0 ("pstore/ram: Simplify ramoops_get_next_prz()
arguments") changed update assignment in getting next persistent ram zone
by adding a check for record type. But the check always returns true since
the record type is assigned 0. And this breaks console ramoops by showing
current console log instead of previous log on warm reset and hard reset
(actually hard reset should not be showing any logs).

Fix this by having persistent ram zone type check instead of record type
check. Tested this on SDM845 MTP and dragonboard 410c.

Reproducing this issue is simple as below:

1. Trigger hard reset and mount pstore. Will see console-ramoops
   record in the mounted location which is the current log.

2. Trigger warm reset and mount pstore. Will see the current
   console-ramoops record instead of previous record.

Fixes: 6fea810ab2c0 ("pstore/ram: Simplify ramoops_get_next_prz() arguments")
Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@codeaurora.org>
Acked-by: Joel Fernandes (Google) <joel@joelfernandes.org>
[kees: dropped local variable usage]
Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/ram.c