mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-30 06:10:56 +00:00
ima: Fix the error code for restoring the PCR value
[ Upstream commit7990ccafaa
] In ima_restore_measurement_list(), hdr[HDR_PCR].data is pointing to a buffer of type u8, which contains the dumped 32-bit pcr value. Currently, only the least significant byte is used to restore the pcr value. We should convert hdr[HDR_PCR].data to a pointer of type u32 before fetching the value to restore the correct pcr value. Fixes:47fdee60b4
("ima: use ima_parse_buf() to parse measurements headers") Signed-off-by: Li Huafei <lihuafei1@huawei.com> Reviewed-by: Roberto Sassu <roberto.sassu@huawei.com> Signed-off-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
536175f006
commit
6b4b3b8404
1 changed files with 2 additions and 2 deletions
|
@ -468,8 +468,8 @@ int ima_restore_measurement_list(loff_t size, void *buf)
|
|||
}
|
||||
}
|
||||
|
||||
entry->pcr = !ima_canonical_fmt ? *(hdr[HDR_PCR].data) :
|
||||
le32_to_cpu(*(hdr[HDR_PCR].data));
|
||||
entry->pcr = !ima_canonical_fmt ? *(u32 *)(hdr[HDR_PCR].data) :
|
||||
le32_to_cpu(*(u32 *)(hdr[HDR_PCR].data));
|
||||
ret = ima_restore_measurement_entry(entry);
|
||||
if (ret < 0)
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue