diff options
author | Kees Cook <keescook@chromium.org> | 2022-10-11 22:01:11 +0200 |
---|---|---|
committer | Kees Cook <keescook@chromium.org> | 2022-10-19 18:25:39 +0200 |
commit | 06b4e09aab6c1ae6b3991a729d2fcb31e358e7f3 (patch) | |
tree | 5b8a38369f5f92974adccae8b10dbb5fd10f8508 /fs/pstore/ram.c | |
parent | pstore/ram: Move internal definitions out of kernel-wide include (diff) | |
download | linux-06b4e09aab6c1ae6b3991a729d2fcb31e358e7f3.tar.xz linux-06b4e09aab6c1ae6b3991a729d2fcb31e358e7f3.zip |
pstore/ram: Set freed addresses to NULL
For good measure, set all the freed addresses to NULL when managing
przs.
Cc: Anton Vorontsov <anton@enomsg.org>
Cc: Colin Cross <ccross@android.com>
Cc: Tony Luck <tony.luck@intel.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-and-tested-by: Guilherme G. Piccoli <gpiccoli@igalia.com>
Link: https://lore.kernel.org/r/20221011200112.731334-5-keescook@chromium.org
Diffstat (limited to 'fs/pstore/ram.c')
-rw-r--r-- | fs/pstore/ram.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index f5bf360cf905..5a39fa8522b0 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c @@ -453,25 +453,27 @@ static void ramoops_free_przs(struct ramoops_context *cxt) int i; /* Free pmsg PRZ */ - persistent_ram_free(cxt->mprz); + persistent_ram_free(&cxt->mprz); /* Free console PRZ */ - persistent_ram_free(cxt->cprz); + persistent_ram_free(&cxt->cprz); /* Free dump PRZs */ if (cxt->dprzs) { for (i = 0; i < cxt->max_dump_cnt; i++) - persistent_ram_free(cxt->dprzs[i]); + persistent_ram_free(&cxt->dprzs[i]); kfree(cxt->dprzs); + cxt->dprzs = NULL; cxt->max_dump_cnt = 0; } /* Free ftrace PRZs */ if (cxt->fprzs) { for (i = 0; i < cxt->max_ftrace_cnt; i++) - persistent_ram_free(cxt->fprzs[i]); + persistent_ram_free(&cxt->fprzs[i]); kfree(cxt->fprzs); + cxt->fprzs = NULL; cxt->max_ftrace_cnt = 0; } } @@ -555,9 +557,10 @@ static int ramoops_init_przs(const char *name, while (i > 0) { i--; - persistent_ram_free(prz_ar[i]); + persistent_ram_free(&prz_ar[i]); } kfree(prz_ar); + prz_ar = NULL; goto fail; } *paddr += zone_sz; |