diff options
author | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-06-18 22:15:51 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-06-20 19:15:22 -0400 |
commit | 90b58d96907e0a45555429c0d3a79c85cea4b9fc (patch) | |
tree | ad2a80bf0c8648493c62822eb140b38db7d1c238 /fs/pstore | |
parent | 924d37118f9e18825294b2012a10c6245d6c25e1 (diff) |
pstore/ram: Fix error handling during przs allocation
persistent_ram_new() returns ERR_PTR() value on errors, so during
freeing of the przs we should check for both NULL and IS_ERR() entries,
otherwise bad things will happen.
Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/pstore')
-rw-r--r-- | fs/pstore/ram.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c index 0b36e91978e6..58b93fbd117e 100644 --- a/fs/pstore/ram.c +++ b/fs/pstore/ram.c | |||
@@ -260,7 +260,7 @@ static void ramoops_free_przs(struct ramoops_context *cxt) | |||
260 | if (!cxt->przs) | 260 | if (!cxt->przs) |
261 | return; | 261 | return; |
262 | 262 | ||
263 | for (i = 0; cxt->przs[i]; i++) | 263 | for (i = 0; !IS_ERR_OR_NULL(cxt->przs[i]); i++) |
264 | persistent_ram_free(cxt->przs[i]); | 264 | persistent_ram_free(cxt->przs[i]); |
265 | kfree(cxt->przs); | 265 | kfree(cxt->przs); |
266 | } | 266 | } |