mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-05 05:42:36 +00:00
pstore: fix potential logic issue in pstore read interface
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>
This commit is contained in:
parent
06cf91b4b4
commit
f5ec25deb2
1 changed files with 8 additions and 1 deletions
|
@ -1006,7 +1006,14 @@ skip:
|
||||||
}
|
}
|
||||||
|
|
||||||
len = erst_read(record_id, &rcd->hdr, sizeof(*rcd) +
|
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)
|
if (uuid_le_cmp(rcd->hdr.creator_id, CPER_CREATOR_PSTORE) != 0)
|
||||||
goto skip;
|
goto skip;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue