* [PATCH 1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete()
@ 2021-12-17 7:12 Dan Carpenter
2021-12-17 7:13 ` [PATCH 2/2] crypto: octeontx2 - prevent underflow in get_cores_bmap() Dan Carpenter
2021-12-24 3:25 ` [PATCH 1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete() Herbert Xu
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-12-17 7:12 UTC (permalink / raw)
To: Boris Brezillon, Srujana Challa
Cc: Arnaud Ebalard, Herbert Xu, David S. Miller, Suheil Chandran,
Shijith Thotton, linux-crypto, kernel-janitors
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(-)
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;
}
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] crypto: octeontx2 - prevent underflow in get_cores_bmap()
2021-12-17 7:12 [PATCH 1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete() Dan Carpenter
@ 2021-12-17 7:13 ` Dan Carpenter
2021-12-24 3:25 ` [PATCH 1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete() Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2021-12-17 7:13 UTC (permalink / raw)
To: Boris Brezillon, Srujana Challa
Cc: Arnaud Ebalard, Herbert Xu, David S. Miller, Suheil Chandran,
Shijith Thotton, Lukasz Bartosik, linux-crypto, kernel-janitors
If we're going to cap "eng_grp->g->engs_num" upper bounds then we should
cap the lower bounds as well.
Fixes: 43ac0b824f1c ("crypto: octeontx2 - load microcode and create engine groups")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
index 07f28d887c2c..392a78298398 100644
--- a/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
+++ b/drivers/crypto/marvell/octeontx2/otx2_cptpf_ucode.c
@@ -29,7 +29,8 @@ static struct otx2_cpt_bitmap get_cores_bmap(struct device *dev,
bool found = false;
int i;
- if (eng_grp->g->engs_num > OTX2_CPT_MAX_ENGINES) {
+ if (eng_grp->g->engs_num < 0 ||
+ eng_grp->g->engs_num > OTX2_CPT_MAX_ENGINES) {
dev_err(dev, "unsupported number of engines %d on octeontx2\n",
eng_grp->g->engs_num);
return bmap;
--
2.20.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete()
2021-12-17 7:12 [PATCH 1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete() Dan Carpenter
2021-12-17 7:13 ` [PATCH 2/2] crypto: octeontx2 - prevent underflow in get_cores_bmap() Dan Carpenter
@ 2021-12-24 3:25 ` Herbert Xu
1 sibling, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2021-12-24 3:25 UTC (permalink / raw)
To: Dan Carpenter
Cc: Boris Brezillon, Srujana Challa, Arnaud Ebalard, David S. Miller,
Suheil Chandran, Shijith Thotton, linux-crypto, kernel-janitors
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.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-12-24 3:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-17 7:12 [PATCH 1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete() Dan Carpenter
2021-12-17 7:13 ` [PATCH 2/2] crypto: octeontx2 - prevent underflow in get_cores_bmap() Dan Carpenter
2021-12-24 3:25 ` [PATCH 1/2] crypto: octeontx2 - out of bounds access in otx2_cpt_dl_custom_egrp_delete() Herbert Xu
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.