summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLiu ShuoX <shuox.liu@intel.com>2014-03-17 14:07:00 -0700
committerTony Luck <tony.luck@intel.com>2014-03-17 14:14:03 -0700
commit34f0ec82e0a99009161a281629280cfcad187696 (patch)
tree82bce069d90f410ff589473b351978c0162e1177
parentb0aa931fb84431394d995472d0af2a6c2b61064d (diff)
pstore: Correct the max_dump_cnt clearing of ramoops
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>
-rw-r--r--fs/pstore/ram.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 6f96d8c2a711..3b5744306ed8 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -320,6 +320,7 @@ static void ramoops_free_przs(struct ramoops_context *cxt)
{
int i;
+ cxt->max_dump_cnt = 0;
if (!cxt->przs)
return;
@@ -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++) {
@@ -508,7 +509,6 @@ fail_buf:
kfree(cxt->pstore.buf);
fail_clear:
cxt->pstore.bufsize = 0;
- cxt->max_dump_cnt = 0;
fail_cnt:
kfree(cxt->fprz);
fail_init_fprz: