msm: camera: memmgr: update correct length in bufq

In a corner case race condition to free the original
ion buf allocated and new ion buffer with same fd but
different size after freeing the origianl ion buf might
result into mismatches in the real ion buf size assigned
in bufq. To avoid this update length in bufq with
local variable.

CRs-Fixed: 3142221
Change-Id: I8241544dba7609662d01f8d765e8d171b8288baa
Signed-off-by: Tejas Prajapati <quic_tpraja@quicinc.com>
This commit is contained in:
Tejas Prajapati committed 2022-03-07 17:26:08 +05:30
1 parent 66de6dd5e0
commit e561ca2a21
1 file changed
+3 -3
+3 -3
View File
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2016-2020, The Linux Foundation. All rights reserved.
* Copyright (c) 2016-2020, 2022 The Linux Foundation. All rights reserved.
*/
#include <linux/module.h>
@@ -680,7 +680,7 @@ int cam_mem_mgr_alloc_and_map(struct cam_mem_mgr_alloc_cmd *cmd)
if (rc) {
CAM_ERR(CAM_MEM,
"Failed in map_hw_va, len=%llu, flags=0x%x, fd=%d, region=%d, num_hdl=%d, rc=%d",
cmd->len, cmd->flags, fd, region,
len, cmd->flags, fd, region,
cmd->num_hdl, rc);
goto map_hw_fail;
}
@@ -709,7 +709,7 @@ int cam_mem_mgr_alloc_and_map(struct cam_mem_mgr_alloc_cmd *cmd)
tbl.bufq[idx].kmdvaddr = kvaddr;
tbl.bufq[idx].vaddr = hw_vaddr;
tbl.bufq[idx].dma_buf = dmabuf;
tbl.bufq[idx].len = cmd->len;
tbl.bufq[idx].len = len;
tbl.bufq[idx].num_hdl = cmd->num_hdl;
memcpy(tbl.bufq[idx].hdls, cmd->mmu_hdls,
sizeof(int32_t) * cmd->num_hdl);