mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
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:
@@ -227,20 +227,11 @@ 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) {
|
||||
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;
|
||||
}
|
||||
} 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 (ctx->is_zero_copy_node) {
|
||||
if (sha_update_ctl->b_is_zero_copy == 0U) {
|
||||
@@ -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",
|
||||
|
||||
Reference in New Issue
Block a user