diff mbox series

[1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete()

Message ID 20211217071232.GG26548@kili
State Accepted
Commit 3438e7220b3183b1ee80227e3a0d742b18df4623
Headers show
Series [1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete() | expand

Commit Message

Dan Carpenter Dec. 17, 2021, 7:12 a.m. UTC
If "egrp" is negative then it is causes an out of bounds access in
eng_grps->grp[].

Fixes: d9d7749773e8 ("crypto: octeontx2 - add apis for custom engine groups")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Herbert Xu Dec. 24, 2021, 3:25 a.m. UTC | #1
On Fri, Dec 17, 2021 at 10:12:32AM +0300, Dan Carpenter wrote:
> If "egrp" is negative then it is causes an out of bounds access in
> eng_grps->grp[].
> 
> Fixes: d9d7749773e8 ("crypto: octeontx2 - add apis for custom engine groups")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

All applied.  Thanks.
diff mbox series

Patch

diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
index 57307eac541c..07f28d887c2c 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
@@ -1695,7 +1695,7 @@  int otx2_cpt_dl_custom_egrp_delete(struct otx2_cptpf_dev *cptpf,
 	if (kstrtoint(tmp, 10, &egrp))
 		goto err_print;
 
-	if (egrp >= OTX2_CPT_MAX_ENGINE_GROUPS) {
+	if (egrp < 0 || egrp >= OTX2_CPT_MAX_ENGINE_GROUPS) {
 		dev_err(dev, "Invalid engine group %d", egrp);
 		return -EINVAL;
 	}