summaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2016-11-15 16:29:40 -0800
committerKees Cook <keescook@chromium.org>2016-11-15 16:34:32 -0800
commitfc46d4e453f50d2b376267f180cae250b54f9fb4 (patch)
tree2c300b1bb28fe0aba34a6b0b0c2ab1fed8e2b3d5 /fs/pstore
parent70ad35db3321a6d129245979de4ac9d06eed897c (diff)
downloadlinux-fc46d4e453f50d2b376267f180cae250b54f9fb4.tar.gz
linux-fc46d4e453f50d2b376267f180cae250b54f9fb4.tar.bz2
linux-fc46d4e453f50d2b376267f180cae250b54f9fb4.zip
ramoops: add pdata NULL check to ramoops_probe
This adds a check for a NULL platform data, which should only be possible if a driver incorrectly sets up a probe request without also having defined the platform_data structure. This is based on a patch from Geliang Tang. Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/ram.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 380222432eff..27c059e1760a 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -734,11 +734,20 @@ static int ramoops_probe(struct platform_device *pdev)
goto fail_out;
}
- /* Only a single ramoops area allowed at a time, so fail extra
+ /*
+ * Only a single ramoops area allowed at a time, so fail extra
* probes.
*/
- if (cxt->max_dump_cnt)
+ if (cxt->max_dump_cnt) {
+ pr_err("already initialized\n");
goto fail_out;
+ }
+
+ /* Make sure we didn't get bogus platform data pointer. */
+ if (!pdata) {
+ pr_err("NULL platform data\n");
+ goto fail_out;
+ }
if (!pdata->mem_size || (!pdata->record_size && !pdata->console_size &&
!pdata->ftrace_size && !pdata->pmsg_size)) {