]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: cavium - prevent integer overflow loading firmware
authorDan Carpenter <dan.carpenter@oracle.com>
Mon, 19 Sep 2022 06:43:27 +0000 (09:43 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 30 Sep 2022 05:57:49 +0000 (13:57 +0800)
commit5f1cdfe7723b6139e469e47a4f69020e387e061c
treee11d83d5b3c1ebad04b1a4a9811b7d8efab6adf3
parentb4aecd9f0e4880170b98d848268117429bf886bd
crypto: cavium - prevent integer overflow loading firmware

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 "ntohl(ucode->code_length) * 2" multiplication can have an
integer overflow.

Fixes: b4451ad6d9e1 ("crypto: cavium - 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/cavium/cpt/cptpf_main.c