aboutsummaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@android.com>2015-01-13 17:32:50 -0500
committerTony Luck <tony.luck@intel.com>2015-01-16 18:47:23 -0500
commitf44f96528a8cd4134a4f2c1a9d8c785600aa4888 (patch)
treeb769fe914e0eab63f216244ec31ce9a95f974e07 /fs/pstore
parentff6bf6e8024f073ecea7dbf5c6afe6bd3872a569 (diff)
pstore: Handle zero-sized prz in series
ramoops_pstore_read fails to return the next in a prz series after first zero-sized entry, not venturing to the next non-zero entry. Signed-off-by: Mark Salyzyn <salyzyn@android.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.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index 34ed8f860e23..6150e54eed30 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -164,6 +164,12 @@ static int ramoops_read_kmsg_hdr(char *buffer, struct timespec *time,
164 return header_length; 164 return header_length;
165} 165}
166 166
167static bool prz_ok(struct persistent_ram_zone *prz)
168{
169 return !!prz && !!(persistent_ram_old_size(prz) +
170 persistent_ram_ecc_string(prz, NULL, 0));
171}
172
167static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type, 173static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
168 int *count, struct timespec *time, 174 int *count, struct timespec *time,
169 char **buf, bool *compressed, 175 char **buf, bool *compressed,
@@ -178,13 +184,13 @@ static ssize_t ramoops_pstore_read(u64 *id, enum pstore_type_id *type,
178 prz = ramoops_get_next_prz(cxt->przs, &cxt->dump_read_cnt, 184 prz = ramoops_get_next_prz(cxt->przs, &cxt->dump_read_cnt,
179 cxt->max_dump_cnt, id, type, 185 cxt->max_dump_cnt, id, type,
180 PSTORE_TYPE_DMESG, 1); 186 PSTORE_TYPE_DMESG, 1);
181 if (!prz) 187 if (!prz_ok(prz))
182 prz = ramoops_get_next_prz(&cxt->cprz, &cxt->console_read_cnt, 188 prz = ramoops_get_next_prz(&cxt->cprz, &cxt->console_read_cnt,
183 1, id, type, PSTORE_TYPE_CONSOLE, 0); 189 1, id, type, PSTORE_TYPE_CONSOLE, 0);
184 if (!prz) 190 if (!prz_ok(prz))
185 prz = ramoops_get_next_prz(&cxt->fprz, &cxt->ftrace_read_cnt, 191 prz = ramoops_get_next_prz(&cxt->fprz, &cxt->ftrace_read_cnt,
186 1, id, type, PSTORE_TYPE_FTRACE, 0); 192 1, id, type, PSTORE_TYPE_FTRACE, 0);
187 if (!prz) 193 if (!prz_ok(prz))
188 return 0; 194 return 0;
189 195
190 if (!persistent_ram_old(prz)) 196 if (!persistent_ram_old(prz))