Skip to content

Commit

Permalink
pstore: fix potential logic issue in pstore read interface
Browse files Browse the repository at this point in the history
1) in the calling of erst_read, the parameter of buffer size
maybe overflows and cause crash

2) the return value of erst_read should be checked more strictly

Signed-off-by: Chen Gong <gong.chen@linux.intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
  • Loading branch information
Chen Gong authored and Tony Luck committed May 16, 2011
1 parent 06cf91b commit f5ec25d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion drivers/acpi/apei/erst.c
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,14 @@ static ssize_t erst_reader(u64 *id, enum pstore_type_id *type,
}

len = erst_read(record_id, &rcd->hdr, sizeof(*rcd) +
erst_erange.size);
erst_info.bufsize);
/* The record may be cleared by others, try read next record */
if (len == -ENOENT)
goto skip;
else if (len < 0) {
rc = -1;
goto out;
}
if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0)
goto skip;

Expand Down

0 comments on commit f5ec25d

Please sign in to comment.