Commit Graph

3569 Commits

Author SHA1 Message Date
Pranav Sanwal
e28c84a699 msm: camera: csid: Check upper bound for cid index
Add check to restrict upper bound on cid_data array.

CRs-Fixed: 3874372
Change-Id: I471ce943a012ec423ac28df4ea0c0e901f75f4cf
Signed-off-by: Pranav Sanwal <quic_psanwal@quicinc.com>
(cherry picked from commit cd41b5384f5fe6da52eb8c638fd183032a5a9365)
2024-09-16 03:25:50 -07:00
Linux Build Service Account
50bc1b3fa8 Merge 00b0ead282 on remote branch
Change-Id: Ib2ce68a6d526893488096a1f51937a324a93c230
2024-08-14 04:05:40 -07:00
Camera Software Integration
00b0ead282 Merge "msm: camera: isp: Get valid csid id" into camera-kernel.lnx.7.0 2024-08-05 00:16:38 -07:00
Yash Upadhyay
edbbcb93c8 msm: camera: common: Stopping HW before stopping tasklet
Tasklet must be stopped after stopping HW. In current implementation
we are stopping same tasklet both in CSID and IFE/TFE stop call. This
change adds to stop both csid and ife/tfe HW first and then stopping
tasklet.

CRs-Fixed: 3855774
Change-Id: I93de831c45d2f61142db300140e36c17e0dd9b31
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
2024-07-28 22:46:59 -07:00
cheese Service
789bc32bbd Merge "msm: camera: core: Add buffer length check to prevent overflow" into camera-kernel.lnx.7.0 2024-07-26 02:38:07 -07:00
cheese Service
47d88e467c Merge "msm: camera: ope: check cpu buffer offset and cmd buf idx" into camera-kernel.lnx.7.0 2024-07-26 02:37:47 -07:00
cheese Service
29bb30ec66 Merge "msm: camera: isp: Fix incorrect offset validation in __cam_isp_ctx_dump_event_record" into camera-kernel.lnx.7.0 2024-07-26 02:37:26 -07:00
cheese Service
4aef95eb42 Merge "msm: camera: icp: io buf config num validation" into camera-kernel.lnx.7.0 2024-07-26 02:37:06 -07:00
cheese Service
9242677094 Merge "msm: camera: icp: Add checking for invalid index" into camera-kernel.lnx.7.0 2024-07-26 02:36:47 -07:00
cheese Service
7e37e05f59 Merge "msm: camera: isp: Fix incorrect offset validation in __cam_isp_ctx_dump_in_top_state" into camera-kernel.lnx.7.0 2024-07-26 02:36:28 -07:00
cheese Service
179c50c49e Merge "msm: camera: jpeg: Avoid UAF in jpeg driver" into camera-kernel.lnx.7.0 2024-07-26 02:36:08 -07:00
cheese Service
e6a07b89d0 Merge "msm: camera: tfe: Add check for num_dev upper bound" into camera-kernel.lnx.7.0 2024-07-26 02:35:48 -07:00
cheese Service
c5925b09c8 Merge "msm: camera: isp: Fix incorrect bound check for ife out resource id" into camera-kernel.lnx.7.0 2024-07-26 02:35:29 -07:00
Gaurav Jindal
10386fd4da msm: camera: isp: Get valid csid id
This change helps to get valid csid id incase
of any IFE is disabled and accessing csid hw caps
with the help of csid id.

CRs-Fixed: 3863667
Change-Id: I57ff8acaaf15b347a69883a54937376843fcd848
Signed-off-by: Gaurav Jindal <quic_gjindal@quicinc.com>
Signed-off-by: Karthik Dillibabu <quic_kard@quicinc.com>
2024-07-24 11:49:34 +05:30
Atiya Kailany
5fe2c8d7e8 msm: camera: core: Add buffer length check to prevent overflow
Previously, context user dumps lacked sufficient checks, risking
buffer overflows. Added length checks for dump headers to ensure
enough buffer space before copying header and exact data from
all kinds of request lists.

CRs-Fixed: 3846871
Change-Id: I02d01af54c9985e5642c31b979c0590494fd5775
Signed-off-by: Atiya Kailany <quic_akailany@quicinc.com>
Signed-off-by: Haochen Yang <quic_haocyang@quicinc.com>
2024-07-23 22:53:39 -07:00
jinguiw
d3fa7f131d msm: camera: ope: check cpu buffer offset and cmd buf idx
No check for cpu buffer offset, which may lead to out of cpu buffer
map. No check for cmd buffer index, which may lead to out of bound
or negative index. Adding check for cpu buffer map offset and
adding check for cmd buffer index.

CRs-Fixed: 3864084
Change-Id: I39494b0a9f323cb5569d37a0c033b2eaf8fbd32c
Signed-off-by: jinguiw <quic_jinguiw@quicinc.com>
2024-07-23 22:51:52 -07:00
Li Sha Lim
78b92d2c5a msm: camera: isp: Fix incorrect offset validation in __cam_isp_ctx_dump_event_record
sizeof(struct cam_isp_context_dump_header) only accounted for once
instead of num_entries times for minimum offset needed when dumping
event record of isp context.

CRs-Fixed: 3865205
Change-Id: I6db25ba2dc4022c2582493aadc4875f9bf9ddb62
Signed-off-by: Li Sha Lim <quic_lishlim@quicinc.com>
2024-07-23 22:50:36 -07:00
jinguiw
ca7146fbc8 msm: camera: icp: io buf config num validation
There are only limitations for CAM_BUF_IN and CAM_BUF_OUT in
config validation, but there will be CAM_BUF_IN_OUT type also.
In process io config, both CAM_BUF_OUT and CAM_BUF_IN_OUT types
are in out_map_entries. No limitation for CAM_BUF_IN_OUT will
lead to out of bound for out_map_entries. This change adds check
for num of io config need in out_map_entries to avoid
out of bound risk.

CRs-Fixed: 3857308
Change-Id: I69163a4264d226d617cbe4f37ba1deb4e6434e31
Signed-off-by: jinguiw <quic_jinguiw@quicinc.com>
2024-07-23 22:48:45 -07:00
Haochen Yang
065d3b2d85 msm: camera: icp: Add checking for invalid index
This change adds extra checking for frame_info_idx to
avoid accessing invalid items in the array.

CRs-Fixed: 3863925
Change-Id: I9f2350aa7d3da35108d26e50ed5198255fc4237a
Signed-off-by: Haochen Yang <quic_haocyang@quicinc.com>
2024-07-23 22:46:36 -07:00
Li Sha Lim
46d5fc4132 msm: camera: isp: Fix incorrect offset validation in __cam_isp_ctx_dump_in_top_state
Each call to cam_common_user_dump_helper consumes
sizeof(struct cam_isp_context_dump_header) in memory.
Currently, this check is not accounted before each call
to common user dump is made in this function. This change fixes it.

CRs-Fixed: 3864098
Change-Id: I66cab5055b085660fb15ff25707fa4ae97403740
Signed-off-by: Li Sha Lim <quic_lishlim@quicinc.com>
2024-07-23 22:44:12 -07:00
Nirmal Abraham
12886c36c4 msm: camera: jpeg: Avoid UAF in jpeg driver
The cam_mem_cpu_put_buf function called immediately after
cam_jpeg_add_command_buffers can cause UAF. To avoid this,
get the in_out param reference in jpeg enc bottom half
and update the out size param.

CRs-Fixed: 3848801
Change-Id: Ib484ad388f0dd356a481a7fede40b9898f713c63
Signed-off-by: Nirmal Abraham <quic_c_nabrah@quicinc.com>
2024-07-23 22:33:54 -07:00
Linux Build Service Account
d0aff24e75 Merge 65c163e410 on remote branch
Change-Id: I5437d3a0aeaf620754c37ed002df40944235a253
2024-07-21 22:39:48 -07:00
Camera Software Integration
3ecdc35c98 Merge "msm: camera: tfe: add upperbound for query cap num devices" into camera-kernel.lnx.7.0 2024-07-19 03:58:10 -07:00
Camera Software Integration
c487ff5163 Merge "msm: camera: tfe: Avoid unclocked access of registers during regdump" into camera-kernel.lnx.7.0 2024-07-19 03:58:06 -07:00
Pranav Sanwal
461fd7ea06 msm: camera: tfe: Add check for num_dev upper bound
Add check for upperbound for num_dev in case of num_dev
assigned less than max_tfe.

CRs-Fixed: 3868093
Change-Id: I7d13467a58617b431d5fbd44a2682fe45d8a23bf
Signed-off-by: Pranav Sanwal <quic_psanwal@quicinc.com>
2024-07-18 02:28:08 -07:00
Mukund Madhusudan Atre
c737143854 msm: camera: isp: Fix incorrect bound check for ife out resource id
Currently, in ife hw manager we are checking the validity of ife out
resource id against the max supported resource id from the header.
The bound check is incorrect as it allows resource id equal to the
max value. Fix this to avoid OOB access.

CRs-Fixed: 3865200
Change-Id: Ib51190a0b089dd8379e1442546e852a81bdb7285
Signed-off-by: Mukund Madhusudan Atre <quic_matre@quicinc.com>
2024-07-16 09:05:54 -07:00
Camera Software Integration
65c163e410 Merge "msm: camera: isp: Update CSID halt sequence" into camera-kernel.lnx.7.0 2024-07-12 00:08:03 -07:00
Camera Software Integration
c3c3b0a4c4 Merge "Revert "Revert "msm: camera: isp: Fixing CSID halt sequence""" into camera-kernel.lnx.7.0 2024-07-12 00:07:51 -07:00
Pranav Sanwal
a3488dfde7 msm: camera: tfe: Avoid unclocked access of registers during regdump
Un-clocked access of registers during dumping the registers while
handling the start failure.
Reason for the issue is that handle regdump trying to read the hw
registers when HW clocks are disabled.
This commits adds a check to validate if the hw is initialized before
accessing the registers.

CRs-Fixed: 3865839
Change-Id: I46878fe1b5442689f8fd909b6bfc9fda0686dac9
Signed-off-by: Pranav Sanwal <quic_psanwal@quicinc.com>
2024-07-11 22:35:00 -07:00
Pranav Sanwal
958e63b8bb msm: camera: tfe: add upperbound for query cap num devices
Add check for upperbound for num devices obtained from query cap v2
preventing integer overflow.

CRs-Fixed: 3864081
Change-Id: I899c794bad2278f39dbea3f80ca701e54cf8d1a9
Signed-off-by: Pranav Sanwal <quic_psanwal@quicinc.com>
2024-07-10 22:31:14 -07:00
Camera Software Integration
aa325873af Merge "msm: camera: req_mgr: Fixing condition to check num_links range" into camera-kernel.lnx.7.0 2024-07-09 01:46:37 -07:00
Camera Software Integration
66499c8ec0 Merge "msm: camera: sensor: TOCTOU error handling in eeprom" into camera-kernel.lnx.7.0 2024-07-09 01:46:27 -07:00
Camera Software Integration
8fbdd92875 Merge "msm: camera: sensor: TOCTOU error handling in eeprom" into camera-kernel.lnx.7.0 2024-07-09 01:46:23 -07:00
Linux Build Service Account
3e345ff86c Merge 6ddbe8dd37 on remote branch
Change-Id: Ia63d563807055565dbc7177973ed95c9687379be
2024-07-04 08:01:41 -07:00
Alok Chauhan
14e77a674a msm: camera: isp: Update CSID halt sequence
Added below change as per discussion with HW team:
1. Disable/enable CG for all the path before/after halting paths
2. Enable PPP CSID path before IPP path during start.

CRs-Fixed: 3835814
Change-Id: I6716c789840292d8ea17cd788dd5e3f28ec0e715
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
Signed-off-by: Alok Chauhan <quic_alokc@quicinc.com>
2024-07-03 17:28:23 +05:30
Haochen Yang
37c2bd7cb9 msm: camera: jpeg: Fix potential OOB access
This change fixes a potential OOB access issue due to
culprit checking.

CRs-Fixed: 3851339
Change-Id: I5a8b8977f815376eeb41a4a227df6e307c7bd99d
Signed-off-by: Haochen Yang <quic_haocyang@quicinc.com>
2024-07-03 04:11:10 -07:00
Alok Chauhan
7462047366 Revert "Revert "msm: camera: isp: Fixing CSID halt sequence""
This reverts commit 508aeed13f.

CRs-Fixed: 3835814
Change-Id: I1b55ffbe50ba370e515ec29582bc78d33b0f6cfb
Signed-off-by: Alok Chauhan <quic_alokc@quicinc.com>
2024-07-02 15:56:18 +05:30
Yash Upadhyay
f747c30cfb msm: camera: req_mgr: Fixing condition to check num_links range
Current condition to verify that num_links lies in range, is always false.
This change adds fix to condition, while checking num_links range to avoid OOB acccess.

CRs-Fixed: 3830586
Change-Id: I6e69cd373c6d15d2133fc6a286b4dde23234a6b3
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
2024-06-28 15:00:46 +05:30
Akash Puliyadi Jegannathan
533ee451e6 msm: camera: sensor: TOCTOU error handling in eeprom
IO config can be modified due to access to shared memory.
This change scopes the data locally so as to avoid
vulnerability of count being modified by external
means while executing due to being in shared memory.

CRs-Fixed: 3777635
Change-Id: Ia5dd9138dcf8449e2d800aca9ffed73d9c4ba3ea
Signed-off-by: Akash Puliyadi Jegannathan <quic_apuliyad@quicinc.com>
2024-06-26 01:51:30 -07:00
Akash Puliyadi Jegannathan
f6a5a3a9a7 msm: camera: sensor: TOCTOU error handling in eeprom
I2C cmd can be modified due to access to shared memory.
This change scopes the data locally so as to avoid
vulnerability of count being modified by external
means while executing due to being in shared memory.

CRs-Fixed: 3777534
Change-Id: I4637f49db67d1bd1d5ca418435e3627b5652f604
Signed-off-by: Akash Puliyadi Jegannathan <quic_apuliyad@quicinc.com>
2024-06-26 01:51:10 -07:00
Linux Build Service Account
b6b35a89f6 Merge 8bdffe141e on remote branch
Change-Id: I692f9f775261a7dd0250e4f5ef41706ced7be3ab
2024-06-19 03:24:49 -07:00
Soumen Ghosh
6ddbe8dd37 msm: camera: core: Out of Bound write in cam_context_user_dump
addr variable to have address bound check, due to that increamenting
of that variable can go corrupt other memory address which could lead to
our of bound access. This change will add extra address change before
access addr variable.

CRs-Fixed: 3802568
Change-Id: I0a2804403dc92fa005f8dda5263242eeb01f4765
Signed-off-by: Soumen Ghosh <quic_soumeng@quicinc.com>
2024-06-11 21:53:40 -07:00
Linux Build Service Account
6f9d249830 Merge 58f39b9ed0 on remote branch
Change-Id: Idb02bd4943e7df1886aca3f69d07be1ae9688c07
2024-06-06 21:16:54 -07:00
Mukund Deshmukh
8bdffe141e msm: camera: sensor: Computation of Reg mask for CSF
Modified Reg mask compuation based on cpas version.

CRs-Fixed: 3824862
Change-Id: I911e0f58c82b360ca7a737929fb908321cbed364
Signed-off-by: Mukund Deshmukh <quic_mdeshmuk@quicinc.com>
2024-06-05 19:33:41 -07:00
Camera Software Integration
b11ccc186f Merge "msm: camera: utils: use updated SCM calls for csf2.5" into camera-kernel.lnx.7.0 2024-06-05 19:27:30 -07:00
Pranav Sanwal
936bc9131a msm: camera: utils: use updated SCM calls for csf2.5
Update and refactor SCM calling procedure in accordance to
CSF2.5 framework for supported targets.

isolate domain_id changes to bypass if only csf2.5 supported.

CRs-Fixed: 3806801
Signed-off-by: Pranav Sanwal <quic_psanwal@quicinc.com>
Change-Id: Idf8ff9716d1e47fb2cea8ea8a34ae3555b29855e
2024-05-29 17:49:41 +05:30
Yash Upadhyay
508aeed13f Revert "msm: camera: isp: Fixing CSID halt sequence"
This reverts commit 6b19fffad2.

CRs-Fixed: 3820616
Change-Id: I62175cc81ca8f897dac50d26e1b1fc5410c82029
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
2024-05-28 11:16:55 +05:30
Yash Upadhyay
5c0dd69c97 msm: camera: isp: Fixing OOB access while defer bufdone
This change fixes OOB access by dynamically allocating memory
for defer bufdone index array and ensuring that allocation
happens after acquire is successful.

CRs-Fixed: 3815399
Change-Id: Icdf5417a74e940ed8ab9f28ac9e0ae22c7bd3c35
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
2024-05-26 10:53:26 -07:00
Yash Upadhyay
58f39b9ed0 msm: camera: isp: Fixing OOB access while defer bufdone
This change fixes OOB access by dynamically allocating memory
for defer bufdone index array and ensuring that allocation
happens after acquire is successful.

CRs-Fixed: 3815399
Change-Id: Icdf5417a74e940ed8ab9f28ac9e0ae22c7bd3c35
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
2024-05-17 02:52:53 -07:00
Linux Build Service Account
308099da62 Merge 494d493271 on remote branch
Change-Id: I57a902cea76c13dbc484a2402011d9561342be78
2024-05-16 12:42:58 -07:00