Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6fb76668 authored by Neeraj Soni's avatar Neeraj Soni Committed by Gerrit - the friendly Code Review server
Browse files

qcrypto: protect potential integer overflow.



Adding user passed parameters without check might
lead to Integer overflow and unpredictable system
behaviour.

Change-Id: Iaf8259e3c4a157e1790f1447b1b62a646988b7c4
Signed-off-by: default avatarNeeraj Soni <neersoni@codeaurora.org>
Signed-off-by: default avatarYang Guang <guyang@codeaurora.org>
parent f8e333c5
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4420,6 +4420,12 @@ int qce_aead_req(void *handle, struct qce_req *q_req)
	else
		q_req->cryptlen = areq->cryptlen - authsize;

	if ((q_req->cryptlen > UINT_MAX - areq->assoclen) ||
		(q_req->cryptlen + areq->assoclen > UINT_MAX - ivsize)) {
			pr_err("Integer overflow on total aead req length.\n");
			return -EINVAL;
	}

	totallen = q_req->cryptlen + areq->assoclen + ivsize;

	if (pce_dev->support_cmd_dscr) {