|
@@ -1,7 +1,7 @@
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
|
|
/*
|
|
|
* Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
|
|
|
- * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
|
|
+ * Copyright (c) 2023-2024, Qualcomm Innovation Center, Inc. All rights reserved.
|
|
|
*/
|
|
|
|
|
|
#include <linux/pid.h>
|
|
@@ -536,11 +536,11 @@ int msm_cvp_map_buf_wncc(struct msm_cvp_inst *inst,
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- list_add_tail(&cbuf->list, &inst->cvpwnccbufs.list);
|
|
|
for (i = 0; i < EVA_KMD_WNCC_MAX_SRC_BUFS; i++)
|
|
|
{
|
|
|
if (inst->cvpwnccbufs_table[i].iova == 0)
|
|
|
{
|
|
|
+ list_add_tail(&cbuf->list, &inst->cvpwnccbufs.list);
|
|
|
inst->cvpwnccbufs_num++;
|
|
|
inst->cvpwnccbufs_table[i].fd = buf->fd;
|
|
|
inst->cvpwnccbufs_table[i].iova = smem->device_addr;
|
|
@@ -1781,6 +1781,10 @@ int msm_cvp_unmap_user_persist(struct msm_cvp_inst *inst,
|
|
|
if (!offset || !buf_num)
|
|
|
return 0;
|
|
|
|
|
|
+ if (offset < (sizeof(struct cvp_hfi_cmd_session_hdr)/sizeof(u32))) {
|
|
|
+ dprintk(CVP_ERR, "%s: Incorrect offset in cmd %d\n", __func__, offset);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
cmd_hdr = (struct cvp_hfi_cmd_session_hdr *)in_pkt;
|
|
|
for (i = 0; i < buf_num; i++) {
|
|
|
buf = (struct cvp_buf_type *)&in_pkt->pkt_data[offset];
|
|
@@ -1815,6 +1819,10 @@ int msm_cvp_map_user_persist(struct msm_cvp_inst *inst,
|
|
|
if (!offset || !buf_num)
|
|
|
return 0;
|
|
|
|
|
|
+ if (offset < (sizeof(struct cvp_hfi_cmd_session_hdr)/sizeof(u32))) {
|
|
|
+ dprintk(CVP_ERR, "%s: Incorrect offset in cmd %d\n", __func__, offset);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
cmd_hdr = (struct cvp_hfi_cmd_session_hdr *)in_pkt;
|
|
|
for (i = 0; i < buf_num; i++) {
|
|
|
buf = (struct cvp_buf_type *)&in_pkt->pkt_data[offset];
|
|
@@ -1857,6 +1865,10 @@ int msm_cvp_map_frame(struct msm_cvp_inst *inst,
|
|
|
if (!offset || !buf_num)
|
|
|
return 0;
|
|
|
|
|
|
+ if (offset < (sizeof(struct cvp_hfi_cmd_session_hdr)/sizeof(u32))) {
|
|
|
+ dprintk(CVP_ERR, "%s: Incorrect offset in cmd %d\n", __func__, offset);
|
|
|
+ return -EINVAL;
|
|
|
+ }
|
|
|
cmd_hdr = (struct cvp_hfi_cmd_session_hdr *)in_pkt;
|
|
|
ktid = atomic64_inc_return(&inst->core->kernel_trans_id);
|
|
|
ktid &= (FENCE_BIT - 1);
|