summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2020-11-10 04:02:13 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2020-11-10 04:02:12 -0800
commit42a8ea012104f655e7fbcd539763ca9cc798cc39 (patch)
treed6d5fec84a19952d9e4259d11c185ffb969c5b05
parente6b5cc6d9676c8ab8494e7d75f61b66b49044e10 (diff)
parentb78e7891460c591ccadc44baf83bd8982fd4fba5 (diff)
Merge "crypto: Fix possible stack out of bound error"
-rw-r--r--drivers/crypto/msm/qce.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/crypto/msm/qce.c b/drivers/crypto/msm/qce.c
index 4cf95b90a2df..53c07aacc145 100644
--- a/drivers/crypto/msm/qce.c
+++ b/drivers/crypto/msm/qce.c
@@ -1,6 +1,6 @@
/* Qualcomm Crypto Engine driver.
*
- * Copyright (c) 2010-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2010-2016, 2020 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -768,6 +768,11 @@ static int _ce_setup(struct qce_device *pce_dev, struct qce_req *q_req,
switch (q_req->alg) {
case CIPHER_ALG_DES:
if (q_req->mode != QCE_MODE_ECB) {
+ if (ivsize > MAX_IV_LENGTH) {
+ pr_err("%s: error: Invalid length parameter\n",
+ __func__);
+ return -EINVAL;
+ }
_byte_stream_to_net_words(enciv32, q_req->iv, ivsize);
writel_relaxed(enciv32[0], pce_dev->iobase +
CRYPTO_CNTR0_IV0_REG);