Skip to content

Commit

Permalink
pstore: Fix NULL pointer fault if get NULL prz in ramoops_get_next_prz
Browse files Browse the repository at this point in the history
ramoops_get_next_prz get the prz according the paramters. If it get a
uninitialized prz, access its members by following persistent_ram_old_size(prz)
will cause a NULL pointer crash.
Ex: if ftrace_size is 0, fprz will be NULL.

Fix it by return NULL in advance.

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 aa9a4a1 commit b0aa931
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs/pstore/ram.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ ramoops_get_next_prz(struct persistent_ram_zone *przs[], uint *c, uint max,
return NULL;

prz = przs[i];
if (!prz)
return NULL;

/* Update old/shadowed buffer. */
if (update)
Expand Down

0 comments on commit b0aa931

Please sign in to comment.