mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
crypto: ccp - Avoid discarding errors in psp_send_platform_access_msg()
[ Upstream commit0e8fca2f12
] Errors can potentially occur in the "processing" of PSP commands or commands can be processed successfully but still return an error code in the header. This second case was being discarded because PSP communication worked but the command returned an error code in the payload header. Capture both cases and return them to the caller as -EIO for the caller to investigate. The caller can detect the latter by looking at `req->header->status`. Reported-and-tested-by: Tim Van Patten <timvp@google.com> Fixes:7ccc4f4e2e
("crypto: ccp - Add support for an interface for platform features") Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7f8f8a83d3
commit
aa89cf8f08
1 changed files with 9 additions and 2 deletions
|
@ -118,8 +118,15 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg,
|
||||||
goto unlock;
|
goto unlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the status in request header for caller to investigate */
|
/*
|
||||||
|
* Read status from PSP. If status is non-zero, it indicates an error
|
||||||
|
* occurred during "processing" of the command.
|
||||||
|
* If status is zero, it indicates the command was "processed"
|
||||||
|
* successfully, but the result of the command is in the payload.
|
||||||
|
* Return both cases to the caller as -EIO to investigate.
|
||||||
|
*/
|
||||||
cmd_reg = ioread32(cmd);
|
cmd_reg = ioread32(cmd);
|
||||||
|
if (FIELD_GET(PSP_CMDRESP_STS, cmd_reg))
|
||||||
req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg);
|
req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg);
|
||||||
if (req->header.status) {
|
if (req->header.status) {
|
||||||
ret = -EIO;
|
ret = -EIO;
|
||||||
|
|
Loading…
Reference in a new issue