msm_fb:hdmi:Fix for sysfs Entry Information Leaks

These sysfs entries leak logical and physical addresses
within the kernel and may be read by any user.
The read permissions for the sysfs entries changed
to S_IRUSR from S_IRUGO.

Change-Id: Idfc58c3b639ea4dfa105ff146467a1c4f01edb6e
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>
msm: msm_fb: validating backlight level and scale value

Validating the value of backlight to be not more than the
max value and also ensuring that the backlight scale value
is not more than 1024, thereby ensuring that backlight
scaling factor is not more than 1

Change-Id: I6a6f4f0f0a8c272edcac5078276fb406ddee3e90
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>

Conflicts:
	drivers/video/msm/msm_fb.c
ALSA: pcm: check for integer overflow during multiplication

Channel info data structure is parsed from userspace and if
user does not set the no. of channels correctly, it could lead
to security vulnerability if we don't check for overflow when the
no. of channels is multiplied with pcm bit width. Add a condition
to check for overflow during multiplication.

CRs-fixed: 537818
Change-Id: Ia3c31406dd8b7627ea704c076643c0348582da28
Signed-off-by: Phani Kumar Uppalapati <phaniu@codeaurora.org>
msm: fb: Null check mfd data

Add appropriate null check for mfd data
structure before accessing it's members.
This prevents null pointer accesses in
the driver.

Change-Id: I5aae937f839e4f6ed8d5c5a4b54ab45f0ff07332
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>

Conflicts:
	drivers/video/msm/msm_fb.c
msm: fb: Copy unsigned int for notify update

Change to correct signature of msmfb_notify_update
from the ioctl declaration.

Change-Id: Ia7bdfd3dbe8494a641ffd46d484794b4bec7d27c
Signed-off-by: Krishna Chaitanya Parimi <cparimi@codeaurora.org>
msm_fb:hdmi:Security check for EDID 3D data parse

While parsing EDID received from TV for 3D data and other,
proper buffer overflow check is done to avoid
data overflow or overwrite.
Also, replace snprintf with scnprintf for better memory copy results.

Change-Id: I4100226a6e5ae0740478f5d85e5b70c9fa20188e
Signed-off-by: Sandeep Panda <spanda@codeaurora.org>

Conflicts:
	drivers/video/msm/external_common.c
msm: msm_fb: Remove Warnings when required BW exceeds Max Bandwidth.

When required BW exceeds max bandwidth, warnings are printed on the
console which are causing performance degradation. This Patch fixes
the issue.

Change-Id: I769f55dd76a3f28639b848bd5461e2ff3abae3f5
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>

Conflicts:
	drivers/video/msm/mdp4_overlay.c
msm-camera: Fix to prevent kernel heap buffer overflow in actuator

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: I5d511e8c1aa2f76f4209a6712a58d8757bc53367
CRs-Fixed: 545979
Signed-off-by: Katta Santhisindhu <kattas@codeaurora.org>

Conflicts:
	drivers/media/video/msm/actuators/msm_actuator.c
msm: kgsl: enable CPU IRQ while suspending context

Make sure that CPU interrupt is enabled before calling adreno
suspend_context when moving from NAP/SLEEP to SLUMBER state.
We send commands to GPU in adreno_drawctxt_switch() which will generate
GPU interrupt. Since CPU interrupt is not enabled, adreno_idle() will
fail because pending interrupt will not be served by CPU this causes
false GPU hang.

CRs-Fixed: 547813

Change-Id: Ia4b730b8f8cda1e820f571ffb7ddb00336ca1a8c
Signed-off-by: Gaurav Gagrani <ggagrani@codeaurora.org>
msm:camera: Initialize a structure before usage

Initialize a structure using memset such that it is
populated properly before returning to userspace.

CRs-fixed: 550567
Change-Id: I2b3c78cd2b309de13acf2811fcc16b8bc04fa052
Signed-off-by: Alok Kediya <kediya@codeaurora.org>

Conflicts:
	drivers/media/video/msm/cpp/msm_cpp.c
msm:camera: Initialize the structure before to pass userspace.

Initialize the structure by memset so that value will pass to
proper to usersapce.

CRs-fixed: 554845
Change-Id: I4adf4bf1bb6e45e16f5fd2e26a74232e6ee7f8bd
Signed-off-by:Vivek Singh<vising@codeaurora.org>

Conflicts:
	drivers/media/video/msm/msm_camera.c
Execute shader on wakeup from power collapse

After wakeup from power-collapse, a shader execution is needed
to reset the GPU to a known and stable state on certain targets.
This change implements the required shader execution only
on initialization and on recovery from power-collapse on A3xx
GPU targets.

CRs-fixed: 526544

Change-Id: Ibd33578ecbb94df5ff276d1e460d94235a82dc43
Signed-off-by: Richard Ruigrok <rruigrok@codeaurora.org>
Signed-off-by: Ananta Kishore K <akollipa@codeaurora.org>

Conflicts:
	drivers/gpu/msm/adreno.h
Revert "msm: kgsl: Submit a draw command on resume"

This reverts commit a24ed9e2aac9c9d85d84c6f49eb451d8fee7b0b5.

Change-Id: I08d8082b9a849227032d6f5f46f12863865d85a2
Signed-off-by: Lynus Vaz <lvaz@codeaurora.org>
Signed-off-by: Ananta Kishore K <akollipa@codeaurora.org>
msm:camera: Bounds and validity check for params

Check the range and validity of parameters before accessing.

CRs-fixed: 550607, 554434, 554436

Change-Id: I2d6aec4f9cb9385789c0df6a2c4abefe9e87539f
Signed-off-by: Alok Kediya <kediya@codeaurora.org>
EHCI: HSIC: improve port resume handling

This patch does the following to ensure that port is resumed
properly and SOF are sent with in 3 msec after the port resume
completion.

1. Use relaxed variants of readl and writel functions to access
registers in the resume critical path to avoid any delays introduced
by barriers.

2. Use ktime based checks to see if controller is started with in 3
msec after port resume is completed. These checks will catch the
cases where there is some delay between port resume and GPT timers
programming.

3. There is no good in polling for PORT_RESUME bit to be cleared.
Controller clears it after ~21 msec. Give 22 msec delay after port
resume and start the controller. Also add a ktime basec check to see
if controller is started with in 3 msec after port resume is completed.
If this timing is not met, perform the tight loop sequence again at
most 3 times.

CRs-Fixed: 553845
Change-Id: I29eab2fa0f684d91e1ac52d14faaffde1113b79b
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>

Conflicts:
	drivers/usb/host/ehci-msm-hsic.c
msm: kgsl: Use msecs_to_jiffies for ADRENO_IDLE_TIMEOUT

This change is about to cherrypick of missing code part
from Change-Id: Ic0dedbad33630706d909931bf616bd69399f7ff1

Change-Id: I6c9766be0651e99251e1cb280f92e06e47875b4f
Signed-off-by: Hareesh Gundu <hareeshg@codeaurora.org>
msm-camera : Fix for Unbounded copy in msm_camera_v4l2_private_control

Fix for the Unbounded copy in msm_camera_v4l2_private_control function

CRs-Fixed: 545962

Change-Id: I36b3cb3193610a090f3fc87273bc71317e7029bd
Signed-off-by: Katta Santhisindhu <kattas@codeaurora.org>

Conflicts:
	drivers/media/video/msm/msm.c
msm:camera: Copy data from user to kernel space before access

This would avoid any invalid access of data.

CRs-fixed: 550608

Change-Id: I30993a9bc731227e72f3be34874505f01357f04d
Signed-off-by: Alok Kediya <kediya@codeaurora.org>
net: rmnet_usb: don't access unet after freeing

When mux is enabled, unet is accessed after freeing it in
rmnet_usb_disconnect(). Fix it by caching the variables that
are required to retrieve unet from unet_list array before
freeing the unet.

CRs-Fixed: 562671
Change-Id: Id21a99db6b3f5da05e89e17f04c01202ea996d06
Signed-off-by: Pavankumar Kondeti <pkondeti@codeaurora.org>

Conflicts:
	drivers/net/usb/rmnet_usb_data.c
msm: msm_fb: Map RGB layers to the max possible size.

IOMMU Page Faults are observed on RGB layers during stability
because MDP is trying to fetch out of mapped area of the buffer.
This patch avoids the issue by overmapping the RGB layers to the
max possible RGB buffer size.

Change-Id: Idc7ac9acad70e351acac5dba2ae43b8731e84d35
Signed-off-by: Vishnuvardhan Prodduturi <vproddut@codeaurora.org>

Conflicts:
	drivers/video/msm/mdp4_overlay.c