]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
pstore/ram: Avoid NULL deref in ftrace merging failure path
authorKees Cook <keescook@chromium.org>
Tue, 4 Dec 2018 00:39:01 +0000 (16:39 -0800)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:22:20 +0000 (14:22 -0300)
commit87934d1eea2a5487a2140849aae84a3fad1f5cae
treece99bde8fcca79621259d68f164e185f64c42b46
parent819794ff633775bca42a250da88d371beef2e0d7
pstore/ram: Avoid NULL deref in ftrace merging failure path

BugLink: https://bugs.launchpad.net/bugs/1857158
[ Upstream commit 8665569e97dd52920713b95675409648986b5b0d ]

Given corruption in the ftrace records, it might be possible to allocate
tmp_prz without assigning prz to it, but still marking it as needing to
be freed, which would cause at least a NULL dereference.

smatch warnings:
fs/pstore/ram.c:340 ramoops_pstore_read() error: we previously assumed 'prz' could be null (see line 255)

https://lists.01.org/pipermail/kbuild-all/2018-December/055528.html

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Fixes: 2fbea82bbb89 ("pstore: Merge per-CPU ftrace records into one")
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
fs/pstore/ram.c