Commit Graph

103 Commits

Author SHA1 Message Date
Lakshmi Narayana Kalavala a805985a97 msm: camera: Fix memory corruption with vb2 buffers
The camera generic buffer manager and isp buffer
manager keep references of vb2 buffers locally during
buffer circulation. If for some reason the vb2 buffers
are freed from a cleanup call from mediaserver. The memory
for the buffers is freed. But the camera buffer managers
still access them for a fraction of time before the cleanup
call is triggered from daemon process. Hence make sure
to access the vb2 buffers only after checking for
the existence in vb2 queues to avoid memory corruption.

Change-Id: I7a1e5f9a3af3345e0c37d3208facbab107a6b9ed
Signed-off-by: Lakshmi Narayana Kalavala <lkalaval@codeaurora.org>
2020-06-06 20:33:37 +02:00
Senthil Kumar Rajagopal 76c635edc2 msm: camera: isp: Handle array out of bounds
The pointer qbuf_buf comes from userspace.
qbuf_buf->num_planes is used with no bound check,
which if set to a large value, it will overflow
buf_info->mapped_info and qbuf_buf->planes

CRs-Fixed: 2003798

Change-Id: I332e0424e57bb14b481a740604a09350e6f029a8
Signed-off-by: Senthil Kumar Rajagopal <skrajago@codeaurora.org>
2018-05-26 00:39:36 +02:00
LuK1337 97104ad488 Merge tag 'LA.BR.1.3.6-04710-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-04710-8976.0"
2017-09-15 11:27:24 +02:00
VijayaKumar T M 28747fad32 msm: camera: fix off-by-one overflow in msm_isp_get_bufq
In msm_isp_get_bufq, if bufq_index equals buf_mgr->num_buf_q,
it will pass the check, leading to off-by-one overflow
(exceed the length of array by one element).

CRs-Fixed: 2031677
Change-Id: I7ea465897e2c37de6ca0155c3e225f1444b3cf13
Signed-off-by: Gaoxiang Chen <gaochen@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
2017-08-21 03:03:29 -07:00
LuK1337 62829e8978 Merge tag 'LA.BR.1.3.6-04010-8976.0' of https://source.codeaurora.org/quic/la/kernel/msm-3.10 into HEAD
"LA.BR.1.3.6-04010-8976.0"

Change-Id: If446d01e5305f2e7b268b761d214305e35e2ce18
2017-06-09 23:21:11 +02:00
VijayaKumar T M c3fe5bc184 msm: camera: Prevent info leak in kernel driver.
-Use %pK for kernel address to avoid the information leak.

CRs-Fixed: 2009672
Change-Id: Ib0631d5578aba033510babe4f43e2a63bb959747
Signed-off-by: Alok Kediya <kediya@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
2017-05-31 10:44:54 -07:00
LuK1337 fc9499e55a Import latest Samsung release
* Package version: T713XXU2BQCO

Change-Id: I293d9e7f2df458c512d59b7a06f8ca6add610c99
2017-04-18 03:43:52 +02:00
Santhosh Kumar Thimmanna Bhattar 1e06a1f0b8 msm: camera: Change %p into %pK
Change %p into %pK to prevent kernel info leak.

Change-Id: Iad411dbba05326aa2bce82aff5e8140fd0a31a08
Signed-off-by: Santhosh Kumar Thimmanna Bhattar <sthim@codeaurora.org>
2016-09-23 13:10:02 +05:30
Pradosh Das 571b43a792 Merge commit '4742aa9efad673157273b07095ac1070dd2f02ea' into HEAD
Conflicts:
        drivers/media/platform/msm/camera_v2/sensor/actuator/msm_actuator.c
        sound/soc/msm/msm8952-slimbus.c

Change-Id: If4516c52837e61afda301496b9053cb44ea59dd9
Signed-off-by: Pradosh Das <prados@codeaurora.org>
2016-07-26 12:02:09 +05:30
Suman Mukherjee 96a7503e8d msm: camera: isp: Fix warning and errors based on static analysis
This change fixes the warning/errors from static analysis

CRs-fixed: 992942
Change-Id: Iaf90ab4c1d17f903d03458d76cab1b4c0a5c8836
Signed-off-by: Shilpa Mamidi <shilpam@codeaurora.org>
2016-05-26 13:31:39 -07:00
Srikanth Uyyala 4a59dd6d6b msm: camera: isp: clean share_list
changes to clean share_list when buffer state is
not DEQUEUED or UNSUED.

Change-Id: Ie69d96dd4ffa65bfb673d5237a454e1ca3dabe33
Signed-off-by: Srikanth Uyyala <suyyala@codeaurora.org>
2016-03-31 15:43:32 +05:30
Venu Yeshala 1fcc980000 msm: camera: isp: Add checks for list updates
Add changes to track buffer being added to list. Add error
messages if buffer is found to be added twice.

Change-Id: I1e10324710e9d6bc0eb594d289b123d78b035d3e
Signed-off-by: Venu Yeshala <vyeshala@codeaurora.org>
2015-11-18 00:41:20 -08:00
Abhishek Kondaveeti 0000b9953b msm: isp: Fix preview freeze
Sync same buffer for pings and pongs
for dual isp

Change-Id: Idc43f589ac52c360384cb0333fa4812765138a6c
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
2015-11-09 03:05:03 -08:00
Sagar Gore 141828ec06 msm: camera: isp: Offline reprocess mode support
Adding support to map buffer in fetch engine driver on the fly.
This is needed for Offline reprocess mode of offline ISP.
Added ioctl to unmap buffer after fetch read done, which are
not part of any bufq/stream.

Change-Id: I25eb7e3fe6218b51f94a7f835393aa40eb1ad611
Signed-off-by: Sagar Gore <sgore@codeaurora.org>
2015-10-30 14:52:02 -07:00
Linux Build Service Account 6541816ffe Merge "msm: camera: stop vfe and never restart when smmu page fault" 2015-10-20 13:53:04 -07:00
Linux Build Service Account e6db1f6afa Merge "msm📷 Init node before adding to queue" 2015-10-20 13:53:03 -07:00
Chandan Gera ee204e8ee8 msm📷 Init node before adding to queue
Init node before adding it to the tail of linked list.

Change-Id: Idd3c550f4c865b3c7f4a98b3952692f3d8b0ef7f
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
2015-10-19 21:27:48 -07:00
Chandan Gera e6bda7cada msm: camera: avoid list double add in case buffer overflow
flush the list properly in case of buffer overflow
so this will avoid duplicate list add.

Change-Id: Iae87d27c3b92e4e58cf45afad0d1096b8cfe9361
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
2015-10-15 00:45:55 -07:00
Chandan Gera be6e9320b9 msm: camera: stop vfe and never restart when smmu page fault
When smmu fault happen, enforce halt and never restart.
This makes sure the HW will not be on by any chance.

Change-Id: I84eba909132f831d4eab0c40b46496fd4ee666ad
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
2015-10-15 00:45:12 -07:00
Venu Yeshala 3fe34e5414 msm: isp: Remove sanity frameID check
The check for frameID sanity/consistency is now moved
to the userspace.
Don't reset the put buf count in case of config pingpong
buffer failure.
Rate limit a couple of error messages.

Change-Id: I1f1ede9d318553bd72295b62c9f82699aa142a0a
Signed-off-by: Venu Yeshala <vyeshala@codeaurora.org>
2015-09-23 11:10:19 +05:30
Linux Build Service Account 47a8483674 Merge "msm📷isp: Accumulate the return value" 2015-09-11 04:57:39 -07:00
Chandan Gera fc57f628a0 msm📷isp:Avoid spin lock recursion on CPU
When CPU do spin lock irq save, it will disable preemption.
If the same CPU do spin lock without disabling preemption,
then second spin lock irq save will hang forever since
the preemption is disabled.

Change-Id: I19dfade29a1a318daf9d9c94ef6a494992cd565f
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
Signed-off-by: Alok Kediya <kediya@codeaurora.org>
2015-09-03 13:23:56 +05:30
Chandan Gera f75f81e74a msm📷isp: Accumulate the return value
return value was getting overwritten after resetting
buf cnt leading to false buf done. We are now making sure
that value gets accumulated.

Change-Id: Ie4c5f3ad8d84593f96004049ef46bdb98123cb98
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
2015-09-01 04:48:11 -07:00
Linux Build Service Account b48fcb6c60 Merge "msm: isp: Fix duplicate timestamp issue" 2015-08-28 04:06:59 -07:00
Abhishek Kondaveeti 4e16ef6f79 msm: isp: Fix duplicate timestamp issue
Avoid sending duplicate frame ids and
timestamps to userspace in order to avoid
recording failures.

Change-Id: I899bb9dbfa457e602977551794de8da0a362e74d
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
2015-08-24 01:59:03 -07:00
Peter Liu ebeb49b0f1 msm: camera: isp: rate limit some potential per irq log
when camera system goes wrong, driver should still avoid
print per irq log since it could lead to irq starving
and watch dog bark.

Change-Id: Ie7f25dd09e328089418a7ec79375f8d865a3fc10
Signed-off-by: Peter Liu <pingchie@codeaurora.org>
2015-08-13 11:07:50 -07:00
Abhishek Kondaveeti a6587ea30d msm: isp: Fix put buf count
Incase of framedrop, reset the put buf count.

Change-Id: I6b81d73161462a5a2fd5a3a4b1866a913b0004fd
Signed-off-by: Abhishek Kondaveeti <akondave@codeaurora.org>
2015-08-04 22:24:20 -07:00
Linux Build Service Account d1082d7197 Merge "msm: isp: Fix list corruption" 2015-07-31 17:13:32 -07:00
Chandan Gera 562e0024d2 msm-camera: Fix list corruption in Dual VFE
In error case where only one VFE is outputing we need to make
sure that shared list doesnt grow indefinately. We need to
drop the particular buffer.

Change-Id: I7dae0ec15a4b8c7b1f8ef62bdf9b3a02581a63d7
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
2015-07-31 02:44:45 -07:00
Nagesh Subba Reddy bd47a04587 msm: isp: Fix list corruption
List corruption can happen due to stale entries in the list. Also, list
corruption can happen if we add the same buffer twice to the shared list.

With this fix,
 1. Whenever we get a flush call, we clear all elements in the
     shared list.
 2. Changed the list_del_init api to list_del.
 3. Added bufq lock protection to msm_isp_update_put_buf_cnt.

Change-Id: I0ea4bd8bf706c3871e2f280f80f6e70c37d9eb36
Signed-off-by: Nagesh Reddy <nageshsreddy@codeaurora.org>
Signed-off-by: Peter Liu <pingchie@codeaurora.org>
2015-07-31 02:44:09 -07:00
Ramesh V 90a9a98385 msm: camera: avoid list double add in case buffer overflow
flush the list properly in case of buffer overflow
so this will avoid duplicate list add.

Change-Id: Idf7e5f2d1831cdc9c7cbee95fbbada53b08435f0
Signed-off-by: Ramesh V <ramev@codeaurora.org>
2015-07-17 01:44:19 -07:00
Harsh Shah 87bd367e47 msm: camera: isp: Update active flag for RDI for start/stop AXI
RDI stream active flag was not set on start_stream. Hence stop_stream
was returning without wait for stop WM. On return the buffer is
released causing IOMMU page fault. Update the active flag correctly
on start and stop to fix this.

Change-Id: I3872e82df4458f4d30db4845301109f0ae9a9ab7
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
2015-07-10 14:27:59 -07:00
Linux Build Service Account 42c9e8d31d Merge "msm: isp: Fix list corruption" 2015-07-03 21:48:06 -07:00
Linux Build Service Account 9946ccc4e6 Merge "msm-camera: Fix list corruption in Dual VFE" 2015-07-03 15:53:48 -07:00
Nagesh Subba Reddy e6d79565a8 msm: isp: Fix list corruption
List corruption can happen due to stale entries in the list. Also, list
corruption can happen if we add the same buffer twice to the shared list.

With this fix,
 1. Whenever we get a flush call, we clear all elements in the
     shared list.
 2. Changed the list_del_init api to list_del.
 3. Added bufq lock protection to msm_isp_update_put_buf_cnt.

Change-Id: I0ea4bd8bf706c3871e2f280f80f6e70c37d9eb36
Signed-off-by: Nagesh Reddy <nageshsreddy@codeaurora.org>
Signed-off-by: Peter Liu <pingchie@codeaurora.org>
2015-07-01 11:55:43 +05:30
Chandan Gera 687b3c043c msm-camera: Fix list corruption in Dual VFE
In error case where only one VFE is outputing we need to make
sure that shared list doesnt grow indefinately. We need to
drop the particular buffer.

Change-Id: I7dae0ec15a4b8c7b1f8ef62bdf9b3a02581a63d7
Signed-off-by: Chandan Gera <cgera@codeaurora.org>
2015-07-01 08:25:09 +05:30
Linux Build Service Account a377a04428 Merge "msm: camera: reset smmu ref count in error case" 2015-06-29 17:51:49 -07:00
Ramesh V a06f9a5c7a msm: camera: reset smmu ref count in error case
Reset ref count in error case during camra crash.

Change-Id: Ic41717c51a9a5f16baa7b1871787eba998def8f4
Signed-off-by: Ramesh V <ramev@codeaurora.org>
2015-06-24 17:06:29 +05:30
Senthil Kumar Rajagopal 92ee43c092 msm: camera: isp: Implementing synchoranization for dual vfe
In case of dual vfe, both vfe hardware is used for same camera
sensor. There are two tasklets serving irq's from each vfe. This
causes synchronization issues if either one of tasklet is delayed.
To fix this, implement synchoranization for dual vfe by using
right vfe to configure the image buffer for both vfe's and
Stats buffer to configure when we get the buffer for both vfe's.

Change-Id: If090bb7526c8d4f544f78e6a9378ebd382253940
Signed-off-by: Senthil Kumar Rajagopal <skrajago@codeaurora.org>
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
2015-06-24 02:38:45 -07:00
Harsh Shah b76e99be13 msm: camera: isp: Move the lock to executing function
Move the lock responsibility from calling method to the place
where the mutually exclusive code executes. This will prevent
potential errors of unprotected calls from calling places.

Change-Id: Ibdd7080774ff686b4fc96d1d2d020564b367b79a
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
2015-06-09 18:09:23 -07:00
Harsh Shah a929926dc8 msm: camera: isp: Add ref count to attach to smmu only once
VFE as a client should attach to smmu driver only once. Add ref_cnt
to prevent additional attach.

Change-Id: I03e24fe3872661d9ae91645a2f80530134e0069d
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
2015-06-05 17:50:48 -07:00
Aditya Jonnalagadda 46af1aceb2 msm: camera: Reverting buffer queue in ispbuf manager
reverting buffer queue in isp buf manager and
check buffer validity in isp buf mgr as in dual vfe
case number of buffer are more and it is taking
more time which causes RCU stall.

Change-Id: I84dc72edd8834ae2addcc7cc33677b10c61ff177
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
2015-05-28 15:02:55 +05:30
Linux Build Service Account 9c5023e3f8 Merge "msm: camera: isp: protect driver from using invalid bufq" 2015-05-07 08:53:24 -07:00
Yiduo Wang bc5a9edc00 msm: camera_v2: Add missing SMMU drivers changes on 3.10 kernel
Camera SMMU driver is new implement on kernel 3.14 and kernel
3.10 also needs to have the same camera SMMU driver. During
the merge process of SMMU driver, there are many SMMU driver
changes in kernel 3.14. So to make SMMU driver consistent in
both kernel 3.14 & 3.10, Add those changes from kernel 3.14
to kernel 3.10.

Change-Id: Ie9da3c1e3fc66d49467fbf112719bdb5c9f53e60
Signed-off-by: Yiduo Wang <yiduow@codeaurora.org>
2015-04-30 16:49:42 -07:00
Yiduo Wang e3b46556d8 msm: camera: isp: Attach to proper context bank handle
If the security mode is not passed properly to
the kernel from user space. ISP would detach to
a wrong context bank. Fixing the issue by tracking
the security mode in buffer manager.

Change-Id: I5c5e5ce2a7c2e2b209c45a605093fe3e5495ef8d
Signed-off-by: Yiduo Wang <yiduow@codeaurora.org>
2015-04-28 00:15:27 -07:00
Linux Build Service Account cc7eb48976 Merge "msm: camera: isp: Frameid mismatch recovery" 2015-04-25 21:56:31 -07:00
Aditya Jonnalagadda a40e14628f msm: camera: Use DMA APIs in Camera driver
This change Create device pointer for each context bank
to keep track of mapping information and uses upstream SMMU
APIS to map buffer into SMMU. Also the driver Abstract
all SMMU APIS for all the camera client drivers thus
avoid duplication of code

Change-Id: I80a159ddb2401defeb1479894bc27c78e0b88e68
Signed-off-by: Aditya Jonnalagadda <ajonnala@codeaurora.org>
2015-04-22 21:59:08 +05:30
Senthil kumar Rajagopal 08a0f5316e msm: camera: isp: Frameid mismatch recovery
If 2 vfe write different frames to same buffer, it causes split.
Add frame id to buf to detect such errors and trigger recovery in
that case.
Also remove prints from process_error_info() and send the framedrop
info as piggyback in SOF event.

Change-Id: I353bf8c5b5df0dbb2f1e973d53f36e8cb23fb1b6
Signed-off-by: Senthil Kumar Rajagopal <skrajago@codeaurora.org>
Signed-off-by: Harsh Shah <harshs@codeaurora.org>
2015-04-16 14:33:36 -07:00
Petar Sivenov a7ea740dec msm: camera: isp: protect driver from using invalid bufq
Userspace can call some ioctls with 0 value for bufq_handle which is
currently can bypass checks in msm_isp_get_bufq and will result in
using uninitialized bufq structure, even though 0 is not a legitimate
value for bufq_handle. This change adds a check to prevent this
behaviour and to return error in case it happens.

Change-Id: I6422ec82671080cfa62fc43026b6cc33261cf11c
Signed-off-by: Petar Sivenov <psiven@codeaurora.org>
2015-04-08 07:13:46 -07:00
Hariram Purushothaman 834b1eed4d msm: camera: Adopt camera buff mgrs to use VB2 MAX buffs
Adopt generic buff mgr and isp buff mgr to use
VB2_MAX_FRAME to support v4l2 supported maximum
buffers.

Change-Id: I7e15749e429e0a8c2f19428e78aca7587c000313
Signed-off-by: Hariram Purushothaman <hariramp@codeaurora.org>
2015-04-03 19:21:07 -07:00