From: Herbert Xu Date: Tue, 27 Jun 2023 09:59:32 +0000 (+0800) Subject: crypto: akcipher - Do not copy dst if it is NULL X-Git-Tag: v6.6.7~2481^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=486bfb05913ac9969a3a71a4dc48f17f31cb162d;p=platform%2Fkernel%2Flinux-starfive.git crypto: akcipher - Do not copy dst if it is NULL As signature verification has a NULL destination buffer, the pointer needs to be checked before the memcpy is done. Fixes: addde1f2c966 ("crypto: akcipher - Add sync interface without SG lists") Signed-off-by: Herbert Xu --- diff --git a/crypto/akcipher.c b/crypto/akcipher.c index e9b6ddc..52813f0 100644 --- a/crypto/akcipher.c +++ b/crypto/akcipher.c @@ -234,7 +234,8 @@ EXPORT_SYMBOL_GPL(crypto_akcipher_sync_prep); int crypto_akcipher_sync_post(struct crypto_akcipher_sync_data *data, int err) { err = crypto_wait_req(err, &data->cwait); - memcpy(data->dst, data->buf, data->dlen); + if (data->dst) + memcpy(data->dst, data->buf, data->dlen); data->dlen = data->req->dst_len; kfree_sensitive(data->req); return err;