msm: kgsl: Take the pagetable reference count only when needed

There could be a race condition where one thread is iterating
over ptlist inside kgsl_get_pagetable() with spinlock acquired
and going to call kref_put(). At the same time another thread is
inside kgsl_put_pagetable() without any spinlock calls kref_put()
and returns without calling kgsl_destroy_pagetable(). The decrement
of refcount by second thread leads to a situation where first thread
enters kgsl_destroy_pagetable_locked() and hence destroying the pt
node from list. This causes the destroyed pt node's next and prev
pointers set to POISON value resulting in kernel panic while executing
next iteration of ptlist.

Taking pt refcount while iterating over ptlist should be avoided if the
spinlock is already held and the pt is not returned to the caller. In
kgsl_get_pagetable(), since the loop is already holding the mutex, it
is safe to look at pt before taking a reference.

CRs-Fixed: 661374
Change-Id: Ide1f57cc1eb3cbf66fa399b6b72491755b999c7a
Signed-off-by: Prabhat Awasthi <pawasthi@codeaurora.org>
power: qpnp-smbcharger: don't reset vddmax trim after EOC

Currently the vddmax trim is being calibrated during the constant
voltage charging in order to charge more accurately. However, when end
of charge happens, this trim is reset back to the original value. On
certain chips with very bad preset trims, this can actually cause the
charger to go into accidental reverse boost when USB is reinserted and
vbat is higher than vddmax by 60mV.

Fix this by not resetting the vddmax trim after EOC or USB removal.

CRs-Fixed: 657755
Change-Id: Iaf9c9eb786ee05e5f326fa87813fe867f6493829
Signed-off-by: Xiaozhe Shi <xiaozhes@codeaurora.org>
msm: mdp: Validate input arguments from user space

Fully verify the input arguments from user client are safe
to use.

Change-Id: Ie14332443b187951009c63ebfb78456dcd9ba60f
Signed-off-by: Raghavendra Ambadas <rambad@codeaurora.org>
msm-camera: Adding lock and unlock methods for
ISP subdev

Added lock mechanism to lock hardware update
when a sof is received, and ignore any other sof
which is received between the update process

Change-Id: If2013a566be0c45a48bf180aa6e16bd5f03cff3c
Signed-off-by: Megha Tak <mtak@codeaurora.org>
msm: wlan: Update wifi database

Update the regulatory database from the mainline kernel

Change-Id: I7a4a164d6a39da1d26ec2df0b7c33bf449f9e9f1
CRs-Fixed: 725522
Signed-off-by: Amar Singhal <asinghal@codeaurora.org>
Merge "power: qpnp-smbcharger: don't reset vddmax trim after EOC"
msm: ADSPRPC: Fix offset for input and output buffers

The buffers being passed to remote processor did not have
the right offset into the IOMMU VA for cases where the offset
was greater than 4K.

Change-Id: I32360a337ecbb9ebe3d33e5a6d680b1033945641
Acked-by: Sathish Ambley <sambley@qti.qualcomm.com>
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
Signed-off-by: Akhila Musunuri <makhila@codeaurora.org>
msm-camera: fix issue of isp unlock method

When we invoke isp unlock, it means isp hardware update just
finished, we should update the "last update frame index" with
current frame id, so that the second hardware update can be avoided
in same frame.

Change-Id: Ib1f9458cba5c93f8d81b8f483f061747450ec3fd
Signed-off-by: ksui <ksui@codeaurora.org>
Signed-off-by: Megha Tak <mtak@codeaurora.org>
Merge "msm: ADSPRPC: Fix offset for input and output buffers"
Merge "msm: wlan: Update wifi database"
Merge "msm-camera: Adding lock and unlock methods for ISP subdev"
Merge "msm-camera: fix issue of isp unlock method"
ASoC: msm: Add bounds checking to ADM get params.

Add additional bounds checking to ADM get params.
Validate that all buffer sizes are valid before
dereferencing.

Change-Id: If7c7a5ae6a56812e9c4a11a38c9bdc78f42d09f3
Signed-off-by: Ben Romberger <bromberg@codeaurora.org>
Signed-off-by: Akhila Musunuri <makhila@codeaurora.org>
ASoC: msm: qdsp6v2: fix passing calibration to wrong AFE port.

Sending speaker protection calibration for wrong afe port
causes crash in ADSP. This is wrong and kernel should
send the parameters only when mixer controls is explicitly
issued.

Change-Id: I5213a99d989b79feede92b3b50eebf84da41cca8
Signed-off-by: Anish Kumar <kanish@codeaurora.org>
Merge "ASoC: msm: Add bounds checking to ADM get params."
Merge "msm: kgsl: Take the pagetable reference count only when needed"
prima: AU_LINUX_ANDROID_LNX.LA.3.5.1_RB1.04.04.04.048.090

Change-Id: I67379204a715771164b7bb7d9eb7ca1342963959
Merge "msm: mdp: Validate input arguments from user space"
Merge "ASoC: msm: qdsp6v2: fix passing calibration to wrong AFE port."
ASoC: msm: qdspv2: Fix junk characters in session name

Initialize MVM session name array to zero to avoid junk
characters at the end.

Change-Id: I441e5dbeb4052c937bb99f9c4c96a91c410db553
CRs-fixed: 702741
Signed-off-by: Karthik Reddy Katta <a_katta@codeaurora.org>