Kees Cook 6c22e4aea4 pstore/ram: Avoid NULL deref in ftrace merging failure path
[ 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>
2019-12-17 20:38:34 +01:00
..
2018-07-08 15:30:51 +02:00
2019-08-06 19:05:23 +02:00
2019-12-17 20:38:33 +01:00
2019-12-17 20:38:15 +01:00
2018-12-21 14:13:04 +01:00
2017-09-04 19:05:15 -04:00
2019-12-05 15:38:25 +01:00