Skip to content

Commit

Permalink
pstore: Correct the max_dump_cnt clearing of ramoops
Browse files Browse the repository at this point in the history
In case that ramoops_init_przs failed, max_dump_cnt won't be reset to
zero in error handle path.

Signed-off-by: Liu ShuoX <shuox.liu@intel.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Tony Luck <tony.luck@intel.com>
  • Loading branch information
Liu ShuoX authored and Tony Luck committed Mar 17, 2014
1 parent b0aa931 commit 34f0ec8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/pstore/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ static void ramoops_free_przs(struct ramoops_context *cxt)
{
int i;

cxt->max_dump_cnt = 0;
if (!cxt->przs)
return;

Expand Down Expand Up @@ -350,7 +351,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt,
GFP_KERNEL);
if (!cxt->przs) {
dev_err(dev, "failed to initialize a prz array for dumps\n");
return -ENOMEM;
goto fail_prz;
}

for (i = 0; i < cxt->max_dump_cnt; i++) {
Expand Down Expand Up @@ -508,7 +509,6 @@ static int ramoops_probe(struct platform_device *pdev)
kfree(cxt->pstore.buf);
fail_clear:
cxt->pstore.bufsize = 0;
cxt->max_dump_cnt = 0;
fail_cnt:
kfree(cxt->fprz);
fail_init_fprz:
Expand Down

0 comments on commit 34f0ec8

Please sign in to comment.