diff options
| author | Ariel Yin <ayin@google.com> | 2017-02-08 16:55:47 -0800 |
|---|---|---|
| committer | Ariel Yin <ayin@google.com> | 2017-02-14 22:19:29 +0000 |
| commit | 79ba2aef843dd3ec2f19e19fa1cebfba8f57fa26 (patch) | |
| tree | e9d1d39b9bd92b39478acda040208f5f2149536a | |
| parent | 98a4e35008737061cd997e2067f362bb40a720eb (diff) | |
crypto: msm: check integer overflow on total data len in qcedev.c
qcedev_vbuf_ablk_cipher will calculate total data length. It starts
with the value of "areq->cipher_op_req.byteoffset", which is controlled
by the user. Make change to check if this total data length has integer
overflow issue in qcedev_check_cipher_params.
Bug: 33544431
CRs-Fixed: 1103089
Change-Id: Ice42dca6d47eb8febfe8a34e566c69e4799fab57
Signed-off-by: Zhen Kong <zkong@codeaurora.org>
Signed-off-by: Biswajit Paul <biswajitpaul@codeaurora.org>
| -rw-r--r-- | drivers/crypto/msm/qcedev.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/crypto/msm/qcedev.c b/drivers/crypto/msm/qcedev.c index 8abfb3d0641..5be5283900b 100644 --- a/drivers/crypto/msm/qcedev.c +++ b/drivers/crypto/msm/qcedev.c @@ -1462,6 +1462,15 @@ static int qcedev_check_cipher_params(struct qcedev_cipher_op_req *req, pr_err("%s: Invalid byte offset\n", __func__); goto error; } + total = req->byteoffset; + for (i = 0; i < req->entries; i++) { + if (total > U32_MAX - req->vbuf.src[i].len) { + pr_err("%s:Integer overflow on total src len\n", + __func__); + goto error; + } + total += req->vbuf.src[i].len; + } } if (req->data_len < req->byteoffset) { @@ -1497,7 +1506,7 @@ static int qcedev_check_cipher_params(struct qcedev_cipher_op_req *req, } } /* Check for sum of all dst length is equal to data_len */ - for (i = 0; i < req->entries; i++) { + for (i = 0, total = 0; i < req->entries; i++) { if (req->vbuf.dst[i].len >= U32_MAX - total) { pr_err("%s: Integer overflow on total req dst vbuf length\n", __func__); |
