summaryrefslogtreecommitdiff
path: root/drivers/crypto/xilinx
diff options
context:
space:
mode:
authorRajan Vaja <rajan.vaja@xilinx.com>2020-05-01 03:52:34 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-05-05 12:35:07 +0200
commit1d9000262b3b80ef6675f35808856073e51be807 (patch)
treeb8e6581629e6f19d3f5816699fc48ee75d2d1c9a /drivers/crypto/xilinx
parent56a9a8068637b624f6724f58c6137f4410616558 (diff)
crypto: xilinx: Handle AES PM API return status
Return value of AES PM API is not handled which may result in unexpected value of "status" in zynqmp_pm_aes_engine(). Consider "status" value as valid only if AES PM API is successful. Fixes: bc86f9c54616 ("firmware: xilinx: Remove eemi ops for aes engine") Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Signed-off-by: Rajan Vaja <rajan.vaja@xilinx.com> Link: https://lore.kernel.org/r/1588330354-27942-1-git-send-email-rajan.vaja@xilinx.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/crypto/xilinx')
-rw-r--r--drivers/crypto/xilinx/zynqmp-aes-gcm.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/drivers/crypto/xilinx/zynqmp-aes-gcm.c b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
index d0a0daf3ea08..a27e3550d2e8 100644
--- a/drivers/crypto/xilinx/zynqmp-aes-gcm.c
+++ b/drivers/crypto/xilinx/zynqmp-aes-gcm.c
@@ -85,6 +85,7 @@ static int zynqmp_aes_aead_cipher(struct aead_request *req)
dma_addr_t dma_addr_data, dma_addr_hw_req;
unsigned int data_size;
unsigned int status;
+ int ret;
size_t dma_size;
char *kbuf;
int err;
@@ -132,9 +133,12 @@ static int zynqmp_aes_aead_cipher(struct aead_request *req)
hwreq->key = 0;
}
- zynqmp_pm_aes_engine(dma_addr_hw_req, &status);
+ ret = zynqmp_pm_aes_engine(dma_addr_hw_req, &status);
- if (status) {
+ if (ret) {
+ dev_err(dev, "ERROR: AES PM API failed\n");
+ err = ret;
+ } else if (status) {
switch (status) {
case ZYNQMP_AES_GCM_TAG_MISMATCH_ERR:
dev_err(dev, "ERROR: Gcm Tag mismatch\n");