mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-06 03:45:24 -04:00
msm: camera: eeprom: Add OOB read check for eeprom memory map
Add check to prevent OOB read of eeprom memory map. Change-Id: Ifeeeffdc2a50536edbde5b5d755a052ace86d596 CRs-Fixed: 3003049 Signed-off-by: Shravan Nevatia <quic_snevatia@quicinc.com>
This commit is contained in:
parent
355f51b649
commit
6c445cfb01
1 changed files with 9 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
* Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
|
||||
* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||
*/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
|
@ -997,7 +998,15 @@ static int32_t cam_eeprom_init_pkt_parser(struct cam_eeprom_ctrl_t *e_ctrl,
|
|||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if ((num_map + 1) >= (MSM_EEPROM_MAX_MEM_MAP_CNT *
|
||||
MSM_EEPROM_MEMORY_MAP_MAX_SIZE)) {
|
||||
CAM_ERR(CAM_EEPROM, "OOB map read error");
|
||||
rc = -EINVAL;
|
||||
goto end;
|
||||
}
|
||||
/* Configure the following map slave address */
|
||||
|
||||
map[num_map + 1].saddr = i2c_info->slave_addr;
|
||||
rc = cam_eeprom_update_slaveInfo(e_ctrl,
|
||||
cmd_buf);
|
||||
|
|
|
|||
Loading…
Reference in a new issue