|
@@ -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>
|
|
@@ -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);
|