cryptodev: update buf addr check for SHA requests

Input buffer VA needs to be checked only for
non-zero copy IVC queues.

Bug 4999798

Change-Id: Ic8bcc44abb65f8e2d614f6734870e81a8d5ec03c
Signed-off-by: Nagaraj P N <nagarajp@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3306711
Reviewed-by: Leo Chiu <lchiu@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
This commit is contained in:
Nagaraj P N
2025-02-20 13:59:09 +05:30
committed by Jon Hunter
parent d27873d84e
commit f552a45569

View File

@@ -227,19 +227,10 @@ static int tnvvse_crypto_validate_sha_update_req(struct tnvvse_crypto_ctx *ctx,
goto exit;
}
if (sha_update_ctl->input_buffer_size == 0U) {
if (sha_update_ctl->is_last == 0U) {
pr_err("%s(): zero length non-last request is not supported\n", __func__);
ret = -EINVAL;
goto exit;
}
} else {
if (sha_update_ctl->in_buff == NULL) {
pr_err("%s(): input buffer address is NULL for non-zero len req\n",
__func__);
ret = -EINVAL;
goto exit;
}
if ((sha_update_ctl->input_buffer_size == 0U) && (sha_update_ctl->is_last == 0U)) {
pr_err("%s(): zero length non-last request is not supported\n", __func__);
ret = -EINVAL;
goto exit;
}
if (ctx->is_zero_copy_node) {
@@ -273,6 +264,13 @@ static int tnvvse_crypto_validate_sha_update_req(struct tnvvse_crypto_ctx *ctx,
goto exit;
}
if ((sha_update_ctl->input_buffer_size > 0U) && (sha_update_ctl->in_buff == NULL)) {
pr_err("%s(): input buffer address is NULL for non-zero len req\n",
__func__);
ret = -EINVAL;
goto exit;
}
if (sha_update_ctl->input_buffer_size >
ivc_database.max_buffer_size[ctx->node_id]) {
pr_err("%s(): Msg size is greater than supported size of %d Bytes\n",