diff options
author | Liu ShuoX <shuox.liu@intel.com> | 2014-03-17 17:07:00 -0400 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2014-03-17 17:14:03 -0400 |
commit | 34f0ec82e0a99009161a281629280cfcad187696 (patch) | |
tree | 82bce069d90f410ff589473b351978c0162e1177 /fs/pstore | |
parent | b0aa931fb84431394d995472d0af2a6c2b61064d (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>
Diffstat (limited to 'fs/pstore')
-rw-r--r-- | fs/pstore/ram.c | 4 |
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) | |||
320 | { | 320 | { |
321 | int i; | 321 | int i; |
322 | 322 | ||
323 | cxt->max_dump_cnt = 0; | ||
323 | if (!cxt->przs) | 324 | if (!cxt->przs) |
324 | return; | 325 | return; |
325 | 326 | ||
@@ -350,7 +351,7 @@ static int ramoops_init_przs(struct device *dev, struct ramoops_context *cxt, | |||
350 | GFP_KERNEL); | 351 | GFP_KERNEL); |
351 | if (!cxt->przs) { | 352 | if (!cxt->przs) { |
352 | dev_err(dev, "failed to initialize a prz array for dumps\n"); | 353 | dev_err(dev, "failed to initialize a prz array for dumps\n"); |
353 | return -ENOMEM; | 354 | goto fail_prz; |
354 | } | 355 | } |
355 | 356 | ||
356 | for (i = 0; i < cxt->max_dump_cnt; i++) { | 357 | for (i = 0; i < cxt->max_dump_cnt; i++) { |
@@ -508,7 +509,6 @@ fail_buf: | |||
508 | kfree(cxt->pstore.buf); | 509 | kfree(cxt->pstore.buf); |
509 | fail_clear: | 510 | fail_clear: |
510 | cxt->pstore.bufsize = 0; | 511 | cxt->pstore.bufsize = 0; |
511 | cxt->max_dump_cnt = 0; | ||
512 | fail_cnt: | 512 | fail_cnt: |
513 | kfree(cxt->fprz); | 513 | kfree(cxt->fprz); |
514 | fail_init_fprz: | 514 | fail_init_fprz: |