Commit Graph

3143 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Camera Software Integration
494d493271 Merge "msm: camera: common: Fixing potential OOB cases" into camera-kernel.lnx.7.0 2024-05-09 00:20:06 -07:00
Camera Software Integration
2bf0b709e0 Merge "msm: camera: isp: Avoiding OOB in defer bufdone handling" into camera-kernel.lnx.7.0 2024-05-09 00:20:03 -07:00
Camera Software Integration
950fb5e35a Merge "msm: camera: utils: populate applied clock rate properly" into camera-kernel.lnx.7.0 2024-05-09 00:19:58 -07:00
Yash Upadhyay
5736242bea msm: camera: isp: Avoiding OOB in defer bufdone handling
Adds changes to dynamically allocate memory for defer bufdone
index array as per number of ports acquired instead of
hardcoded max resource value which could change target wise.

CRs-Fixed: 3788295
Change-Id: I5d5f43ac41e6abbac0b270eeaf97475b4e39a5d7
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
2024-04-30 14:25:05 +05:30
Yash Upadhyay
96bbf9473a msm: camera: common: Fixing potential OOB cases
This change validates scratch buffer offset and kmd
cmd buffer offset length to avoid OOB access issues,
This change adds fix to sizeof operater's parameter,
Adds fix to avoid buffer overflow.

CRs-Fixed: 3800787
Change-Id: I619b56e8dc262911b17072a03c103e2986c32ed4
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
2024-04-29 05:46:19 -07:00
Camera Software Integration
d32cda396b Merge "msm: camera: cpas: Add support to update camera qos" into camera-kernel.lnx.7.0 2024-04-28 22:45:18 -07:00
Camera Software Integration
88daa83530 Merge "msm: camera: sync: Avoiding UAF on get dma fence" into camera-kernel.lnx.7.0 2024-04-28 22:44:10 -07:00
Camera Software Integration
1aa641e0f3 Merge "msm: camera: cdm: Prevention from OOB on virtual cdm write" into camera-kernel.lnx.7.0 2024-04-25 07:26:01 -07:00
Camera Software Integration
cf0526ccbd Merge "msm: camera: sensor: Offset Validation before dereferencing" into camera-kernel.lnx.7.0 2024-04-25 07:25:59 -07:00
Alok Chauhan
1f72d2fd80 msm: camera: utils: populate applied clock rate properly
Currently applied clock rate variable is getting updated
with default -ve value for clocks for which no rate set.
This is giving wrong impression of clock rate being applied.

Updated applied clock rate based on clock rate value set.

CRs-Fixed: 3794045
Change-Id: Ib37165dbaf4c1ec56abff1d3ba3eaf21eae79734
Signed-off-by: Alok Chauhan <quic_alokc@quicinc.com>
2024-04-22 02:13:07 -07:00
Depeng Shao
5b8ab83787 msm: camera: memmgr: Remove the mutex lock for kref variable
kref operation is atmoic operation, so no need to use mutex
to protect it, and the cam_mem_put_cpu_buf is also called
in spinlock context, so we can't use mutex lock in this
function. This change removes the mutex lock for kref
variable protextion.

CRs-Fixed: 3786887
Change-Id: Ic05bdafacf06cde6a8d8dbae7512e5d22eb7f514
Signed-off-by: Depeng Shao <quic_depengs@quicinc.com>
(cherry picked from commit bb64b99c83b3bb6da0c241eda74ebe8a19b51840)
2024-04-21 19:32:15 -07:00
Yash Upadhyay
d6d05fba0b msm: camera: cdm: Prevention from OOB on virtual cdm write
Adds proper sanity on virtual cdm right operation to avoid
OOB register space access. After getting the mapped buffers
through cam_mem_get_cpu_buf() in kernel, userspace is still
able to access those buffers. So, the validation of offsets
and sizes does not have any advantage if userspace can alter
those parameters after we have validated them. That's why we
copied the information in kernel before we validate that.

CRs-Fixed: 3778045
Change-Id: I3b53549419b40a92333263e29d93220577d691e9
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
2024-04-19 09:17:36 +05:30
Dharmender Sharma
15af46a8b6 msm: camera: cpas: Add support to update camera qos
This change add support to update camera qos statically
and dynamically via hyp.
For each NIU camera driver can call scm API with each NIU's
register offsets, value and number of registers offset that need to be
programed.

CRs-Fixed: 3781697
Change-Id: I42705dd2b379e29f7f32f9c2564cc476dc8c1308
Signed-off-by: Dharmender Sharma <quic_dharshar@quicinc.com>
2024-04-17 03:08:29 -07:00
Yash Upadhyay
96ff7cbcd8 msm: camera: sync: Avoiding UAF on get dma fence
Two threads can access same dma fence, one to get_fence and other
to put_fence. Missing locks and checks on fence could lead to use
after free case. This change adds proper locks and checks before
dma fence get call to avoid this.

CRs-Fixed: 3782903
Change-Id: I283e87f09c44b57bed3dbb782113f3629c9a29bd
Signed-off-by: Yash Upadhyay <quic_yupadhya@quicinc.com>
2024-04-16 22:19:22 -07:00
Abhilash Mahapatra
b321b9ac17 msm: camera: sensor: Offset Validation before dereferencing
- Validation of settings_array_offset which is populated
  from umd as sizeof(CSLTPGSettingsConfigCmd).

CRs-Fixed: 3788500
Change-Id: Ic848d537f1b56bcfc47b295b063e9670313c9a33
Signed-off-by: Abhilash Mahapatra <quic_abhmah@quicinc.com>
2024-04-16 02:58:27 -07:00
Camera Software Integration
f6b44a99e3 Merge "msm: camera: memmgr: Add refcount to track umd in use buffers" into camera-kernel.lnx.7.0 2024-04-15 07:20:51 -07:00
zhuo
77cdd783b0 msm: camera: memmgr: Add refcount to track umd in use buffers
Currently krefcount is using by umd and kmd. Due to sometimes
there is issue in umd, such as release twice. That maybe causes
buffer release before kmd access the buffer. This commit add
a new refcount to track umd in use buffers and use current krefcount
to track kmd in use buffers. For the same buffer use in kmd and umd
only when all refcount become zero, the buffer start to release.

CRs-Fixed: 3692103
Change-Id: I5a58d9bab4c82bdb192d6a6a3d2b3d254dc04c9e
Signed-off-by: zhuo <quic_zhuo@quicinc.com>
2024-04-06 16:44:21 +08:00
Alok Chauhan
5f8e6f8031 msm: camera: tfe: Skip overwrite bw limiter for TFE WMs
TFE is programming WM's bw limiters with default value
without considering if it's already set via blob from UMD.

Skip bw limiter programming for TFE WMs for which
limiter values programmed via blob.

CRs-Fixed: 3767707
Change-Id: I30190def8b2a08c577b3bf1fa71fd2fe3db53c86
Signed-off-by: Alok Chauhan <quic_alokc@quicinc.com>
2024-04-05 10:07:59 +05:30
Camera Software Integration
4408d24dab Merge "msm: camera: isp: fix incorrect sizeof expression" into camera-kernel.lnx.7.0 2024-04-01 01:59:10 -07:00
Camera Software Integration
dac2c184d4 Merge "msm: camera: tfe: handle out_of_sync interrupt as non fatal" into camera-kernel.lnx.7.0 2024-04-01 01:58:42 -07:00
Camera Software Integration
7faeb4a453 Merge "msm: camera: csiphy: Expand CSIPHY Onthego support" into camera-kernel.lnx.7.0 2024-04-01 01:58:29 -07:00
Camera Software Integration
2b214147d4 Merge "msm: camera: sensor: Cleaning redundant code" into camera-kernel.lnx.7.0 2024-04-01 01:58:16 -07:00
Shivi Mangal
6245be68a9 msm: camera: sensor: Handling race condition in util api
I2C cmd is coming from user space which 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: 3707472
Change-Id: I8a89e23e99b80b089ed4c4cf3098feead752356e
Signed-off-by: Shivi Mangal <quic_smangal@quicinc.com>
(cherry picked from commit 4e00cc5f9f81bf471d58ee5d6beb210a5326fcff)
2024-03-26 03:53:05 -07:00
Pranav Sanwal
913a74d72a msm: camera: tfe: handle out_of_sync interrupt as non fatal
Handle out_of_sync_frame_drop interrupt as non fatal till
3 successive occurences. fix prevention of mup bit override
when programming RDI.

CRs-Fixed: 3638271
Change-Id: Ie2f7ef476b76b5074b12b0eb503ae0be1100611a
Signed-off-by: Pranav Sanwal <quic_psanwal@quicinc.com>
2024-03-26 00:10:04 -07:00
Camera Software Integration
e8fb277c8d Merge "msm: camera: sensor: Optimize usleep_range call during power on/off" into camera-kernel.lnx.7.0 2024-03-25 23:45:20 -07:00
Shivakumar Malke
dafa3fd726 msm: camera: isp: fix incorrect sizeof expression
This change fixes incorrect sizeof expression prevent
issue.

CRs-Fixed: 3765096
Change-Id: I0b9b947f44e7d9066731d741752b11022d8cc084
Signed-off-by: Shivakumar Malke <quic_smalke@quicinc.com>
2024-03-21 03:33:18 -07:00
Camera Software Integration
af0f7b69bf Merge "msm: camera: isp: Fix prevent issues in cam_isp" into camera-kernel.lnx.7.0 2024-03-20 10:14:40 -07:00
Camera Software Integration
352ce6b61d Merge "msm: camera: icp: Avoid resource leak during comp bind failure" into camera-kernel.lnx.7.0 2024-03-20 10:14:33 -07:00