OSDN Git Service

pstore/ram: Write new dumps to start of recycled zones
authorAleksandr Yashkin <a.yashkin@inango-systems.com>
Tue, 7 Jan 2020 18:26:55 +0000 (10:26 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Jan 2020 10:22:46 +0000 (11:22 +0100)
commit0f367dae495f437b7b39f2577b34e74012248e8f
treef0b36b4a8db28207f02424a2480e59afb02a7970
parent2a6f0cec5c8e564569ad6411a446051a3bd1b5b1
pstore/ram: Write new dumps to start of recycled zones

[ Upstream commit 9e5f1c19800b808a37fb9815a26d382132c26c3d ]

The ram_core.c routines treat przs as circular buffers. When writing a
new crash dump, the old buffer needs to be cleared so that the new dump
doesn't end up in the wrong place (i.e. at the end).

The solution to this problem is to reset the circular buffer state before
writing a new Oops dump.

Signed-off-by: Aleksandr Yashkin <a.yashkin@inango-systems.com>
Signed-off-by: Nikolay Merinov <n.merinov@inango-systems.com>
Signed-off-by: Ariel Gilman <a.gilman@inango-systems.com>
Link: https://lore.kernel.org/r/20191223133816.28155-1-n.merinov@inango-systems.com
Fixes: 896fc1f0c4c6 ("pstore/ram: Switch to persistent_ram routines")
[kees: backport to v4.9]
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/pstore/ram.c