Commit Graph

16788 Commits

Author SHA1 Message Date
Sumalatha Malothu 65ee88a2db msm: camera_v2: handle the error value returned during get clock
currently only NULL pointer check is used to validate the return
value from clk_get, this change to handle all the failures.
This snapshot is taken from msm-4.9
Ported it from 4.9 to 3.18

Change-Id: Icd8b7e33d0f235a7c5dde2307972a594908e6a60
Signed-off-by: Sumalatha Malothu <smalot@codeaurora.org>
[haggertk: Backport to 3.4/msm8974. Note that this includes patching
 the non-standard camera_ll implementation as well on this kernel.]
CVE-2019-10524
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-05-12 21:47:27 +02:00
Oliver Neukum 27893455f4 media: dvb: usb: fix use after free in dvb_usb_device_exit
[ Upstream commit 6cf97230cd5f36b7665099083272595c55d72be7 ]

dvb_usb_device_exit() frees and uses the device name in that order.
Fix by storing the name in a buffer before freeing it.

Signed-off-by: Oliver Neukum <oneukum@suse.com>
Reported-by: syzbot+26ec41e9f788b3eba396@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
CVE-2019-15213
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
Change-Id: Ia218933795b4847765450522202d1b67e326c3cd
2020-04-18 17:55:14 +02:00
Sean Young ba1fa1611b media: technisat-usb2: break out of loop at end of buffer
commit 0c4df39e504bf925ab666132ac3c98d6cbbe380b upstream.

Ensure we do not access the buffer beyond the end if no 0xff byte
is encountered.

Reported-by: syzbot+eaaaf38a95427be88f4b@syzkaller.appspotmail.com
Signed-off-by: Sean Young <sean@mess.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
[bwh: Backported to 3.16: technisat_usb2_get_ir() still uses a stack
 buffer, which is not worth fixing on this branch]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
CVE-2019-15505
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
Change-Id: I9561df3437dec3d0bd2770c1f831d68bb26a9a6e
2020-04-18 17:55:14 +02:00
BAProductions 17e79001c4 fix camera exposure on the Tab 4
Change-Id: I696956caff9659809341af1b9276e83584bc6b63
2020-01-22 14:27:31 -05:00
Francescodario Cuzzocrea 0f35225e59 camera: add compatibility for galaxy tab 4 modules
- import sensor drivers from T530NUUES1BPL1 source drop
 - do not use the new flicker_type

Change-Id: I71c883898fa8c318ebd598835e9bea7db20e2065
2020-01-06 08:40:54 +01:00
Pratap Nirujogi 2cf28b274d msm: camera: cpp: Check for valid tx level
TX and RX FIFOs of Microcontroller are used to exchange commands
and messages between Micro FW and CPP driver. TX FIFO depth is
16 32-bit words, incase of errors there is a chance of overflow.
To prevent possible out of bound access, TX FIFO depth or
level is checked for MAX depth before accessing the FIFO.

Change-Id: I5adf39b46ff10e358c4a2c03a2de07d44b99cedb
Signed-off-by: Pratap Nirujogi <pratapn@codeaurora.org>
[haggertk: Backport to 3.4/msm8974. Note that this includes patching
 the non-standard camera_ll implementation as well on this kernel.]
CVE-2018-11986
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-01-06 08:40:51 +01:00
Francescodario Cuzzocrea 49e809a3be msm8226-common: update radio-iris driver from
https://github.com/LineageOS/android_kernel_motorola_msm8226 @ cm-14.1

This is needed because the stock driver which comes from OSRC requires
firmware loading. Using stock blobs for firmware loading however does
not work, so simply swich to this driver which does not require firmware
loading and just work with the aosp libfmjni
2020-01-06 08:40:48 +01:00
Francescodario Cuzzocrea 95bf835906 Revert "BACKPORT: msm: camera: Add regulator enable and disable independent of CSID"
* This breaks loading csiphy from our user space blobs

This reverts commit 62856dafc3.
2020-01-06 08:40:47 +01:00
Y-T-G 20b0da57d9 misc: fix some GCC warnings 2020-01-06 08:40:46 +01:00
xXPR0T0TYPEXx a83629e62c camera: s3ve3g(ds): keep rear camera sensor type separate
Keep the rear camera sensor type between the Galaxy S3 Neo+ (s5k4h5yb) and Galaxy S3 Neo duos (imx175) separate to avoid sensor id mismatches.
2020-01-06 08:40:46 +01:00
xXPR0T0TYPEXx c94ec77c40 camera: backward compatibility for old s3ve3g(ds) camera mm modules
Allow the camera driver to load old libmmcamera2* modules without the support of flicker_type and new frame_id.
2020-01-06 08:40:46 +01:00
Alistair Strachan e1438ed2ea media: uvcvideo: Fix 'type' check leading to overflow
commit 47bb117911b051bbc90764a8bff96543cbd2005f upstream.

When initially testing the Camera Terminal Descriptor wTerminalType
field (buffer[4]), no mask is used. Later in the function, the MSB is
overloaded to store the descriptor subtype, and so a mask of 0x7fff
is used to check the type.

If a descriptor is specially crafted to set this overloaded bit in the
original wTerminalType field, the initial type check will fail (falling
through, without adjusting the buffer size), but the later type checks
will pass, assuming the buffer has been made suitably large, causing an
overflow.

Avoid this problem by checking for the MSB in the wTerminalType field.
If the bit is set, assume the descriptor is bad, and abort parsing it.

Originally reported here:
https://groups.google.com/forum/#!topic/syzkaller/Ot1fOE6v1d8
A similar (non-compiling) patch was provided at that time.

Reported-by: syzbot <syzkaller@googlegroups.com>
Bug: 111760968
Signed-off-by: Alistair Strachan <astrachan@google.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Change-Id: Ieaad998693c4fcd0ea5f9902f50ad3b979e967d8
CVE-2019-2101
[haggertk: Backport to 3.4/msm8974 (path change)]
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-01-06 08:40:44 +01:00
Haibin Liu 17ea8d368d msm: sensor: actuator: avoid accessing out of bound memory
Issue:
When total_steps is updated, after that, copy_from_user
fails with an error, then, i2c_reg_tbl is not allocated.
In this case, when calling msm_actuator_parse_i2c_params,
it lead to out-of-bound memory write.

Fix:
1) Assign total_steps to zero when error from copying.
2) Add NULL pointer check for i2c tbl.

CRs-Fixed: 2111672
Change-Id: Ib9dcb182356e2df8078c131edfd0791fa95a35e0
Signed-off-by: Haibin Liu <haibinl@codeaurora.org>
[haggertk: Backport to 3.4/msm8974. Note that this includes patching
 the non-standard camera_ll implementation as well on this kernel.]
CVE-2017-15857
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-01-06 08:40:27 +01:00
Chinmay Sawarkar 3c50fa1407 msm: vidc: Fix use after free bug in set_output_buffers
When set_buffers fails, binfo is freed and again accessed
while freeing smem memory.

CRs-Fixed: 2118860
Change-Id: Ifdd683f907862665e34d6d39d5a8634984804c01
Signed-off-by: Chinmay Sawarkar <chinmays@codeaurora.org>
CVE-2018-5844
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-01-06 08:40:26 +01:00
Praveen Chavan e91edb302c msm: vidc: update the check to ignore extradata plane in dqbuf
userptr may or may not be a null-value. Checking for this field
to qualify a plane as extradata has no merit. Ignore that check

Bug: 28747768
Change-Id: I08d85ef462f09003aaa17f6ebc5d27de7083796f
Signed-off-by: Praveen Chavan <pchavan@codeaurora.org>
Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-01-06 08:40:25 +01:00
Praveen Chavan d69a20bbab msm: vidc: add ion_handle checking before mapping buffers
Compare ion handles in driver instead of matching fds
to check if a buffer is already mapped or not.

Bug: 28747768

Change-Id: Ifd18d8689351c4a6a22c988d359fb413be19e142
Signed-off-by: Ashray Kulkarni <ashrayk@codeaurora.org>
Signed-off-by: Praveen Chavan <pchavan@codeaurora.org>
Signed-off-by: Deva Ramasubramanian <dramasub@codeaurora.org>
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-01-06 08:40:25 +01:00
Surajit Podder b2878e80a2 msm: vidc: Add same fd ref only for static buffer mode
Add same fd ref only for static buffer mode.
Driver is configured for dynamic buffer mode by
default on Venus 3xx targets. If client uses the
same fd for all output buffers, then the first
buffer can remain mapped without reference, which
is incompatible with the curently logic which
assumes buffers to have a reference if they are
already mapped

CRs-Fixed: 773605
Change-Id: I025fe373532e185660d43bae28457cbf06f20e7a
Signed-off-by: Surajit Podder <spodder@codeaurora.org>
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-01-06 08:40:24 +01:00
Rajesh Bondugula 8831019b96 msm: camera: sensor: Validate destination step position
dest_step_position is sent from userspace and is used in
kernel to calculate the final DAC value.
dest_step_position must be validated against total steps.
Actuator will have an unexpected behavior if lens value is
programed to actuator based on invalid dest_step_position.

CRs-Fixed: 1102580
Change-Id: Idcd97043d3bd583d8577233d446a99d1829a4ee6
Signed-off-by: Rajesh Bondugula <rajeshb@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2020-01-06 08:40:24 +01:00
Robb Glasser 12c68d820d uvcvideo: Prevent heap overflow in uvc driver
The size of uvc_control_mapping is user controlled leading to a
potential heap overflow in the uvc driver. This adds a check to verify
the user provided size fits within the bounds of the defined buffer
size.

Signed-off-by: Robb Glasser <rglasser@google.com>
[groeck: cherry picked from
 https://source.codeaurora.org/quic/la/kernel/msm-3.10
 commit b7b99e55bc7770187913ed092990852ea52d7892;
 updated subject]
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
CVE-2017-0627
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>

Change-Id: I20cf8a2b443dad1f9f93dae3cae3cf17b76af99d
2020-01-06 08:40:24 +01:00
Abdulla Anam f6587d6f2d msm: vidc: Allocate memory dynamically for debugfs info_reads
Use dynamically allocated memory for constructing strings in
core_info_read & inst_info_read. This ensures that there is no
contention for a shared memory & hence avoids the requirement of
a lock. Allocate on demand, as the calls implement a debugfs
facility and hence rarely invoked. Statically allocated memory
otherwise remain idle.

Change-Id: I3ae04e0a51801a2fc901591e41e28ff6b7d198b4
Signed-off-by: Abdulla Anam <abdullahanam@codeaurora.org>
Signed-off-by: Sanjay Singh <sisanj@codeaurora.org>
CVE-2017-9718
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-08 15:03:05 +02:00
Daniel Mentz d2a89e4932 v4l2: Refactor, fix security bug in compat ioctl32
The 32-bit compat v4l2 ioctl is implemented based on its 64-bit
equivalent. It converts 32-bit data structures into its 64-bit
equivalents and needs to provide the data to the 64-bit ioctl in user
space memory which is commonly allocated using
compat_alloc_user_space(). However, due to how that function is
implemented, it can only be called a single time for every syscall
invocation.  Supposedly to avoid this limitation, the existing code uses
a mix of memory from the kernel stack and memory allocated through
compat_alloc_user_space(). Under normal circumstances, this would not
work, because the 64-bit ioctl expects all pointers to point to user
space memory. As a workaround, set_fs(KERNEL_DS) is called to
temporarily disable this extra safety check and allow kernel pointers.
However, this might introduce a security vulnerability: The
result of the 32-bit to 64-bit conversion is writeable by user space
because the output buffer has been allocated via
compat_alloc_user_space(). A malicious user space process could then
manipulate pointers inside this output buffer, and due to the previous
set_fs(KERNEL_DS) call, functions like get_user() or put_user() no longer
prevent kernel memory access.

The new approach is to pre-calculate the total amount of user space
memory that is needed, allocate it using compat_alloc_user_space() and
then divide up the allocated memory to accommodate all data structures
that need to be converted.

An alternative approach would have been to retain the union type karg
that they allocated on the kernel stack in do_video_ioctl(), copy all
data from user space into karg and then back to user space. However,
we decided against this approach because it does not align with other
compat syscall implementations. Instead, we tried to replicate the
get_user/put_user pairs as found in other places in the kernel:

if (get_user(clipcount, &up->clipcount) ||
    put_user(clipcount, &kp->clipcount)) return -EFAULT;

BUG: 34624167
Change-Id: Ica92695d8ddf60c0a067ea2f833f22a71710932e
Signed-off-by: Daniel Mentz <danielmentz@google.com>
Reported-by: C0RE Team
CVE-2017-13166
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-08 15:03:04 +02:00
Maggie White e6882fa78f msm: camera: isp: fix for out of bound access array
There is no bound check in stream_cfg_cmd->num_streams and it's used in
several places as a maximum index into the stream_cfg_cmd->stream_handle
array which has a size of 15. Current code didn't check the maximum
index to make sure it didn't exceed the array size.

Bug: 62379525
Change-Id: Idcf639486d235551882dafc34d9e798d78c70bf0
Signed-off-by: Maggie White <maggiewhite@google.com>
CVE-2017-8251
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-08 12:08:30 +02:00
Gaoxiang Chen 76801c1910 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
Bug: 36136563
Change-Id: I7ea465897e2c37de6ca0155c3e225f1444b3cf13
Signed-off-by: Gaoxiang Chen <gaochen@codeaurora.org>
CVE-2017-11000
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-08 12:08:16 +02:00
Petar Sivenov 8eecf8b86d 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>
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-08 12:08:07 +02:00
Andrea Arcangeli 92d0f6e8be msm: camera: Fix various small issues in cci driver: fix retvals
This reports an error to the caller after adding the bound checks,
otherwise potentially undefined/unexpected behaviour may result.

Change-Id: Id2897aa5ce4587762b5eda89f7481788d689d0a8
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 12:28:59 +02:00
Nick Desaulniers 62856dafc3 BACKPORT: msm: camera: Add regulator enable and disable independent of CSID
Regulator enable and disable of CSIPHY depends on the CSID module.
Make the enable and disable of clk regulator independent of CSIPHY.

Bug: 33299365
CRs-Fixed: 1107702
Change-Id: Iabb5eb28d63b34a4c3201c53be17054a1907f4fe
Signed-off-by: Ravi Kishore Tanuku <rktanuku@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
Signed-off-by: Dennis Cagle <d-cagle@codeaurora.org>
(cherry picked from commit b1bb44c9cca61e48ec6158abad6e7969a8e58abf)
CVE-2017-8264
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 12:26:42 +02:00
Gaoxiang Chen e0ec196e6d msm: camera: don't cut to 8bits for validating enum variable
In msm_ispif_is_intf_valid(),
we convert a enum variable msm_ispif_vfe_intf,
to uint8_t type for validating.

This could cause potential issue,
if the value is crafted in such a way that lower 8bits pass the validation.

Don't use uint8_t as input parm to avoid such vulnerability.

CRs-Fixed: 2008469
Change-Id: I4ee400ac0edd830decfbe5712966d968976a268a
Signed-off-by: Gaoxiang Chen <gaochen@codeaurora.org>
CVE-2017-8260
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 12:26:41 +02:00
Abdulla Anam 01d705b8dd msm: vidc: Protect debug_buffer access in core_info_read with lock.
Serialize core_info_read with lock so that multiple concurrent
threads do not cause the write to overflow. Also have the bound
check to avoid overflow in write_str function.

CRs-Fixed: 2013361
CAF-Change-Id: Ia18a4b94cafd69af1d367861f2499fc202f18e9f
Signed-off-by: Abdulla Anam <abdullahanam@codeaurora.org>
Signed-off-by: Sanjay Singh <sisanj@codeaurora.org>
CVE-2017-8244
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>

Change-Id: I8d21d662534f1679594042f3a5b6bcfb4884e11f
2019-08-06 12:26:40 +02:00
Suman Mukherjee 91078a612e msm: sensor: validate the i2c table index before use
Verifying the i2c table index value before accessing
the i2c table to avoid memory corruption issues.
CRs-Fixed: 1065916

Change-Id: I165ba6cb6493d923439430d7b055675f95f20a8b
Signed-off-by: Sureshnaidu Laveti <lsuresh@codeaurora.org>
Signed-off-by: Suman Mukherjee <sumam@codeaurora.org>
[haggertk]: Partial, most of original commit was already incorporated
by Samsung
CVE-2016-6755
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 12:05:40 +02:00
VijayaKumar T M 15fd3d334d msm: camera: Restructure data handling to be more robust
Use dynamic array allocation instead of static array to
prevent stack overflow.
User-supplied number of bytes may result in integer overflow.
To fix this we check that the num_byte isn't above 8K size.

CRs-Fixed: 1060554
Change-Id: I9b05b846e5cc3a62b1a0a67be529f09abc764796
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
[haggertk]: Partial, most of original commit was already incorporated
by Samsung
CVE-2016-6741
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 12:02:10 +02:00
Ayaz Ahmad 8bee297d24 radio: iris: Use kernel API to copy data from user space
Use copy_from_user kernel api to copy any data from user space
to kernel space.

Change-Id: Ia3b7bb0f98180bd8792c1c18e930cb5609b8dc82
CRs-Fixed: 540320
Signed-off-by: Ayaz Ahmad <aahmad@codeaurora.org>
CVE-2014-9882
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 11:48:12 +02:00
Jim Rasche cc98ba445c msm📷 Fix multiple bounds check
Added bounds check to user input num_streams at several location,
without checking a position outside array could be dereferenced

Change-Id: I6e82d8b51e4ec6772316c7daef243240c029db96
Signed-off-by: Jim Rasche <jrasche@codeaurora.org>
CVE-2014-9867
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 11:43:09 +02:00
Vasko Kalanoski 0327dc062b msm: actuator: fix to prevent kernel heap buffer overflow
fix to prevent kernel heap buffer overflow allows user
controlled data to be written to the heap via the
msm_camera actuator IOCTLs

Change-Id: I4458831e28e0081fb2f5ae55506be866100e1b4f
Signed-off-by: Vasko Kalanoski <vaskok@codeaurora.org>
CVE-2014-9786
[haggertk]: Partial only, as half the original change was removed by
Samsung source commit.
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 11:41:53 +02:00
Hariram Purushothaman fc8a9bec0e msm: camera: Fix various small issues in cci driver
Remove some unused ioctl exposed, Also add
some bound checks for ioctl user params.

Change-Id: Ifdd441fdb25fd20b005c4e4e1ebe4e203f1216ac
CRs-Fixed: 511382
Signed-off-by: Hariram Purushothaman <hpurus@codeaurora.org>
CVE-2014-9783
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-06 11:41:45 +02:00
Kevin F. Haggerty 238a0fb5ad Merge tag 'v3.4.113' into lineage-16.0
This is the 3.4.113 stable release

Change-Id: I80791430656359c5447a675cbff4431362d18df0
Signed-off-by: Kevin F. Haggerty <haggertk@lineageos.org>
2019-08-05 14:20:47 +02:00
Francescodario Cuzzocrea e20e6a0613 Merge tag 'LA.BF.1.1.3-02310-8x26.0' into lineage-16.0 2019-08-05 11:18:51 +02:00
Francescodario Cuzzocrea 85baa390bf misc: Import SM-G900H kernel source code
* Samsung Package Version: G800HXXU1CRJ1
    * CAF Tag: LA.BF.1.1.3-00110-8x26.0
2019-08-02 15:14:10 +02:00
VijayaKumar T M 07c021203e msm: camera: ispif: Add missing mutex usage in ioctl
Mutex usage is added into the ispif ioctl path to ensure
these paths are thread safe.

CRs-Fixed: 1074310
Change-Id: Id718f83484bc4acf98ade0205328aad6ee306270
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
2017-01-28 21:54:19 -08:00
VijayaKumar T M af99b4f13a msm: sensor: Avoid potential stack overflow
Add a check to validate the user input data is not
greater than expected stack buffer size to avoid out
of bounds array accesses

CRs-Fixed: 1056307
Change-Id: I8b31006772367a120828269243b1971d33a4d7d3
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
2017-01-05 12:57:09 +05:30
Linux Build Service Account ceb437a326 Merge "msm: camera: restructure data handling to be more robust" 2016-11-26 01:46:52 -08:00
VijayaKumar T M ad4184dcd3 msm: camera: restructure data handling to be more robust
Add dynamic array allocation instead of static to prevent
stack overflow.

CRs-Fixed: 789704
Change-Id: Id12ed5b01809021d2b1d1d71436f2523b575d9de
Signed-off-by: Vasko Kalanoski <vaskok@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
2016-11-23 11:44:53 +05:30
VijayaKumar T M 28179d92dd msm: camera: cpp: Add validation for v4l2 ioctl arguments
In CPP v4l2 ioctl command is made, if _IOC_DIR(cmd) is
_IOC_NONE, then the user-supplied argument arg is not checked
and an information disclosure is possible.

CRs-Fixed: 1042068
Change-Id: Iddb291b10cdcb5c42ab8497e06c2ce47885cd5ab
Signed-off-by: Sunid Wilson <sunidw@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
2016-11-22 16:11:02 +05:30
VijayaKumar T M af482a2ed8 msm: camera: Restructure data handling to be more robust
Use dynamic array allocation instead of static array to
prevent stack overflow.
User-supplied number of bytes may result in integer overflow.
To fix this we check that the num_byte isn't above 8K size.

CRs-Fixed: 1060554
Change-Id: I9b05b846e5cc3a62b1a0a67be529f09abc764796
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
2016-11-14 11:15:58 +05:30
Sanjay Singh 2f8543b77c msm: vidc: use %pK instead of %p which respects kptr_restrict sysctl
Hide kernel pointers from unprivileged ussers by using %pK format-
specifier instead of %p. This respects the kptr_restrict sysctl
setting which is by default on. So by default %pK will print zeroes
as address. echo 1 to kptr_restrict to print proper kernel addresses.

CRs-Fixed: 987018
Change-Id: I4772257a557c6730ecc0624cbc8e5614e893e9fd
Signed-off-by: Sanjay Singh <sisanj@codeaurora.org>
2016-11-03 16:16:58 +05:30
Rajesh Bondugula c6869db5a6 msm: camera: sensor: Validate step_boundary
step_boundary can take values upto the total_steps
Validate the step_boundary before consuming it.
Convert the type of step_index and region_index to uint16_t
step_index and region_index cannot be negative.

CRs-Fixed: 1001092
Change-Id: I1f23fd6f28bb897824a1ef99a8873b9f986eee70
Signed-off-by: Rajesh Bondugula <rajeshb@codeaurora.org>
2016-08-08 05:04:04 -07:00
Vijaya Kumar T M 91c9804b29 msm: camera: isp: Fix warning and errors based on static analysis
This change fixes the warning/errors from static analysis

Conflicts:
        drivers/media/platform/msm/camera_v2/isp/msm_isp_axi_util.c
        drivers/media/platform/msm/camera_v2/isp/msm_isp_util.c
        drivers/media/platform/msm/camera_v2/ispif/msm_ispif.c

CRs-fixed: 992942
Change-Id: Iaf90ab4c1d17f903d03458d76cab1b4c0a5c8836
Signed-off-by: Jing Zhou <jzhou70@codeaurora.org>
Signed-off-by: Vijaya Kumar T M <vtmuni@codeaurora.org>
2016-07-12 18:29:52 +05:30
Vijaya Kumar T M 9e9c3c34d0 msm: camera: ispif: Validate VFE num input during reset
Userspace supplies the actual number of used VFEs in session to ISPIF.
Validate the userspace input value and if found to be invalid, return
error.

CRs-Fixed: 898074
Change-Id: I3288ddb6404e817a705a92281b4c54666f372c56
Signed-off-by: Venu Yeshala <vyeshala@codeaurora.org>
Signed-off-by: Vijaya Kumar T M <vtmuni@codeaurora.org>
2016-07-12 18:04:34 +05:30
Trishansh Bhardwaj b31a31a84c msm: camera: Fix memory read security flaw
Adds bound check on reg_cfg_cmd->u.dmi_info.hi_tbl_offset.

IOCTL VIDIOC_MSM_VFE_REG_CFG uses usersupplied value without
performing bounds check for following cmd_type.
VFE_READ_DMI_16BIT
VFE_READ_DMI_32BIT
VFE_READ_DMI_64BIT

Change-Id: I554c45ef3a172f5b5891b67a7e8e7a1f3f3882ed
Signed-off-by: Trishansh Bhardwaj <tbhardwa@codeaurora.org>
Signed-off-by: VijayaKumar T M <vtmuni@codeaurora.org>
2016-07-12 16:01:49 +05:30
Praneeth Paladugu 7e1db7d2cf msm: vidc: Use registeredbuf.lock for buffer synchronization
Right now dynamic buffers are managed with both sync_lock and
registeredbufs.lock. sync_lock is meant only for state
transition. Hence remove sync_lock and achieve the same purpose
with registeredbufs.lock.

Change-Id: I3b0eb62019e7e992f63c159bf65d8c21cf2f52c8
Signed-off-by: Praneeth Paladugu <ppaladug@codeaurora.org>
Signed-off-by: Vikash Garodia <vgarodia@codeaurora.org>
Signed-off-by: Vasantha Balla <vballa@codeaurora.org>
2016-07-07 22:54:47 -07:00
Arun Menon f693ac940d msm: vidc: Clean up video instance locking logic
Clean up unnecessary locks in video driver code.

Change-Id: Ib00527531863a06fa0bad28ed3cc71fbdf167e2d
Signed-off-by: Arun Menon <avmenon@codeaurora.org>
Signed-off-by: Vasantha Balla <vballa@codeaurora.org>
2016-07-08 10:36:22 +05:30