]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: marvell/octeontx - prevent integer overflows
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 19 Sep 2022 06:43:19 +0000 (09:43 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 30 Sep 2022 05:57:49 +0000 (13:57 +0800)
commit79d60d14e47a757a78591279fab35480d7c024a1
treefa7aff4413513e5bb300f74e96714a8dd348ed47
parent8bce8cf75f9fb8ab22d5d79daf02789b0fcbfd6f
crypto: marvell/octeontx - prevent integer overflows

The "code_length" value comes from the firmware file.  If your firmware
is untrusted realistically there is probably very little you can do to
protect yourself.  Still we try to limit the damage as much as possible.
Also Smatch marks any data read from the filesystem as untrusted and
prints warnings if it not capped correctly.

The "code_length * 2" can overflow.  The round_up(ucode_size, 16) +
sizeof() expression can overflow too.  Prevent these overflows.

Fixes: 4b3a3d69919f ("crypto: marvell - add support for OCTEON TX CPT engine")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/marvell/octeontx/otx_cptpf_ucode.c