[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <VI1PR0402MB34853A1681A83D311AD74599981D0@VI1PR0402MB3485.eurprd04.prod.outlook.com>
Date: Mon, 27 May 2019 16:37:15 +0000
From: Horia Geanta <horia.geanta@....com>
To: Iuliana Prodan <iuliana.prodan@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
Aymen Sghaier <aymen.sghaier@....com>
CC: "David S. Miller" <davem@...emloft.net>,
"linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
dl-linux-imx <linux-imx@....com>
Subject: Re: [PATCH v3 1/2] crypto: caam - fix pkcs1pad(rsa-caam, sha256)
failure because of invalid input
On 5/24/2019 5:46 PM, Iuliana Prodan wrote:
> @@ -1030,17 +1076,26 @@ int caam_pkc_init(struct device *ctrldev)
> if (!pk_inst)
> return 0;
>
> + /* allocate zero buffer, used for padding input */
> + zero_buffer = kzalloc(CAAM_RSA_MAX_INPUT_SIZE - 1, GFP_DMA |
> + GFP_KERNEL);
> + if (!zero_buffer)
> + err = -ENOMEM;
Either return -ENOMEM or jump to a label before return err.
> +
> err = crypto_register_akcipher(&caam_rsa);
> - if (err)
> + if (err) {
> + kfree(zero_buffer);
> dev_warn(ctrldev, "%s alg registration failed\n",
> caam_rsa.base.cra_driver_name);
> - else
> + } else {
> dev_info(ctrldev, "caam pkc algorithms registered in /proc/crypto\n");
> + }
>
> return err;
> }
>
> void caam_pkc_exit(void)
> {
> + kfree(zero_buffer);
> crypto_unregister_akcipher(&caam_rsa);
> }
Regards,
Horia
Powered by blists - more mailing lists