]> git.baikalelectronics.ru Git - 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)
committerKees Cook <keescook@chromium.org>
Tue, 4 Dec 2018 01:11:02 +0000 (17:11 -0800)
commit94f755546b59fe3edc6ca653006e76eaf64700fc
treebdada3a5c2f1cd06ab97f37dd9736217d7167bc8
parentfa10f439632c7b61ba6b5187f409f6f4f6b842e9
pstore/ram: Avoid NULL deref in ftrace merging failure path

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: bac118b5f85c ("pstore: Merge per-CPU ftrace records into one")
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
fs/pstore/ram.c